scala - Play Framework using View Tags -
this day 1 play framework , using view templates
application.scala
package controllers import play.api._ import play.api.mvc._ class application extends controller { val productmap = map(1 -> "keyboard", 2 -> "mouse", 3 -> "monitor") def listproducts() = action { ok(views.html.products(productmap.values.toseq)) } }
routes
get /listproducts controllers.application.listproducts
view
@(products: seq[string]) @import tags._ @productsiterator(products)
view tag
@(products: seq[string]) <ul> @for(product <- products) { <li>@product</li> } </ul>
the error getting is
@6mgadekbj - internal server error, (get) [/listproducts] -> play.sbt.playexceptions$compilationexception: compilation error[**too many arguments method apply**: ()play.twirl.api.htmlformat.appendable in class productsiterator] @
looks me. maybe it's old compilation older code? ./activator clean
.
Comments
Post a Comment