Menu
  • HOME
  • TAGS

Why do I get a type mismatch for a map as a routing parameter?

java,dictionary,playframework,scala-template

I've got it almost completely working now ... altough I dont completely understand how: My button in the view-class, now without any parameter <a href="@routes.Application.sendMap()"><button class="btn btn-default" type="button">Absenden</button> My controller-class now correctly puts another fake question/answer pair into the map and then returns it with the changed map to the...

switching between RTL and LTR in play framework

playframework,internationalization,playframework-2.3,scala-template

The closest thing I find that, I put a method in acontroller that get lang() then get if its RTL or LTR then load the CSSs and JSs accoding to that from my main.scala.html. so that I shouldn't be worry about passing the if statement from every controller method, the...

Play Framework Template Field value as Object

playframework,playframework-2.0,scala-template

Ok .. it was to simple :-). Next day, next try. I added the attribute to the object "analysis.name" and that was the solution. It can be handled such like the access of the object. @entryControlItem("analysis.name").value ...

Play2.2 Java - Prevent escaping on Javascript template

javascript,json,playframework,playframework-2.2,scala-template

Solution: @JavaScript(Json.stringify(TaskType.valuesJson())); Explanation: Play use a JavaScript template format for files "*.js", so you need to use @JavaScript rather than @Html. It's clear after understanding how the templates engine works... Sources: Helped to get there: playframework JsValue in HTML Template Helped to get there: Render a Play!Framework2 javascript as template?...

Dynamically change (@main) name, in Play Framework 2.2.2 (Scala)

scala,playframework-2.2,scala-template

Each template gets compiled into a class with one method, calling the template is not dynamic but just like calling any other method/function in Scala or Java. Making this dynamic is possible using reflection but you will loose the static type check that ensures that you will get a compiler...

How to transfer questions / answers pairs into a view-class in the playframework?

java,scala,data-structures,playframework,scala-template

Just use an inner loop to iterate over the answers (because the value variable will hold the answers to the question of the loop iteration): index.scala.html @import model.Question @import model.Answer @(myMap: Map[Question, List[Answer]]) @for((key, value) <- myMap){ @key.questionText<br> @for(ans <- value){ <p>Possible answer: @ans.answerText</p> } } ...