import java.util.ArrayList;
import java.util.HashMap;

import spark.ModelAndView;
import spark.template.velocity.VelocityTemplateEngine;
import static spark.Spark.*;

public class App {
    public static void main(String[] args) {
        staticFileLocation("/public");
        String layout = "templates/layout.vtl";

        get("/", (request, response) -> {
            HashMap<String, Object> model = new HashMap<String, Object>();
            model.put("tasks", request.session().attribute("tasks"));
            model.put("template", "templates/index.vtl");
            return new ModelAndView(model, layout);
        }, new VelocityTemplateEngine());

        post("/tasks", (request, response) -> {
            HashMap<String, Object> model = new HashMap<String, Object>();
            model.put("tasks", Task.all());
            model.put("template", "templates/tasks.vtl");
            return new ModelAndView(model, layout);
        }, new VelocityTemplateEngine());

        get("/tasks/new", (request, response) -> {
          HashMap<String, Object> model = new HashMap<String, Object>();
          model.put("template", "templates/task-form.vtl");
          return new ModelAndView(model, layout);
        }, new VelocityTemplateEngine());

        post("/tasks", (request, response) -> {
          HashMap<String, Object> model = new HashMap<String, Object>();
          String description = request.queryParams("description");
          Task newTask = new Task(description);
          model.put("template", "templates/success.vtl");
        }, new VelocityTemplateEngine());

        get("/tasks/:id", (request, response) -> {
          HashMap<String, Object> model = new HashMap<String, Object>();

          Task task = Task.find(Integer.parseInt(request.params(":id")));
          model.put("task", task);
          model.put("template", "templates/task.vtl");
          return new ModelAndView(model, layout);
        }, new VelocityTemplateEngine());

    }
}

@@ -1,31 +1,4 @@
-import java.util.ArrayList;
 %0Aimp
@@ -20,17 +20,16 @@
 ashMap;%0A
-%0A
 import s
@@ -151,18 +151,16 @@
 s App %7B%0A
-  
   public
@@ -194,20 +194,16 @@
 args) %7B%0A
-    
     stat
@@ -229,28 +229,24 @@
 blic%22);%0A    
-  
-  
 String layou
@@ -274,20 +274,16 @@
 .vtl%22;%0A%0A
-    
     get(
@@ -310,38 +310,32 @@
 nse) -%3E %7B%0A      
-  
-    
 HashMap%3CString, 
@@ -385,84 +385,8 @@
 ();%0A
-            model.put(%22tasks%22, request.session().attribute(%22tasks%22));%0A      
     
@@ -425,38 +425,32 @@
 es/index.vtl%22);%0A
-      
       return new
@@ -475,36 +475,32 @@
 l, layout);%0A    
-  
-  
 %7D, new VelocityT
@@ -514,39 +514,34 @@
 Engine());%0A%0A    
-    pos
+ge
 t(%22/tasks%22, (req
@@ -563,30 +563,24 @@
  -%3E %7B%0A      
-     
- 
 HashMap%3CStri
@@ -626,30 +626,24 @@
  Object%3E();%0A
-      
       model.
@@ -670,30 +670,24 @@
 l());%0A      
- 
-     
 model.put(%22t
@@ -722,30 +722,24 @@
 tl%22);%0A      
-   
-   
 return new M
@@ -758,36 +758,32 @@
 model, layout);%0A
-    
     %7D, new Veloc
@@ -805,34 +805,29 @@
 ne());%0A%0A    
- 
-   
 get(%22
-/
 tasks/new%22, 
@@ -843,36 +843,32 @@
  response) -%3E %7B%0A
-    
       HashMap%3CSt
@@ -918,36 +918,32 @@
 bject%3E();%0A      
-    
 model.put(%22templ
@@ -968,36 +968,32 @@
 ask-form.vtl%22);%0A
-    
       return new
@@ -1014,36 +1014,32 @@
 model, layout);%0A
-    
     %7D, new Veloc
@@ -1057,28 +1057,25 @@
 Engine());%0A%0A
-    
+%0A
     post(%22/t
@@ -1082,33 +1082,32 @@
 asks%22, (request,
- 
 response) -%3E %7B%0A 
@@ -1097,36 +1097,32 @@
 ,response) -%3E %7B%0A
-    
       HashMap%3CSt
@@ -1180,20 +1180,16 @@
 ;%0A      
-  
-  
 String d
@@ -1239,28 +1239,24 @@
 on%22);%0A      
-    
 Task newTask
@@ -1279,36 +1279,32 @@
 ription);%0A      
-  
-  
 model.put(%22templ
@@ -1335,24 +1335,66 @@
 .vtl%22);%0A    
+  return new ModelAndView(model, layout);%0A
     %7D, new V
@@ -1416,28 +1416,24 @@
 Engine());%0A%0A
-    
     get(%22/ta
@@ -1473,20 +1473,16 @@
 %7B%0A      
-    
 HashMap%3C
@@ -1537,20 +1537,16 @@
 ct%3E();%0A%0A
-    
       Ta
@@ -1605,36 +1605,32 @@
 %22:id%22)));%0A      
-    
 model.put(%22task%22
@@ -1638,20 +1638,16 @@
  task);%0A
-    
       mo
@@ -1695,20 +1695,16 @@
 ;%0A      
-    
 return n
@@ -1735,20 +1735,16 @@
 ayout);%0A
-    
     %7D, n

Fix errors in paths.