Guest User

Untitled

a guest
Sep 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. How is it possible to pass multiple params into a template in Play 2.0?
  2. String one = "one";
  3. String two = "two";
  4. return ok(template.render(one,two));
  5.  
  6. @(one: String, two: String)
  7.  
  8. This is first param: @one <br/>
  9. This is second param: @two
  10.  
  11. public static Result index() {
  12.  
  13. Map<String, String> labels = new HashMap<String, String>();
  14.  
  15. labels.put("first", "First label");
  16. labels.put("second", "Second label");
  17. // etc etc
  18. labels.put("hundredth", "Label no. 100");
  19.  
  20. return ok(template.render(labels));
  21. }
  22.  
  23. @(labels: Map[String, String])
  24.  
  25. @labels.get("first") <br/>
  26. @labels.get("second") <br/>
  27. .....
  28. @labels.get("hundredth")
Add Comment
Please, Sign In to add comment