The Play framework Scala template engine repackaged for stand-alone use.
Questions tagged [twirl]
147 questions
0
votes
1 answer
Twirl template default parameter value is not applied
I have a Play 2.5 template which starts from the following declaration:
@(title: String)(content: Html)(menu:Html = HtmlFormat.empty)(implicit request:Request[AnyContent])
So the second parameter is declared having a default value.
Now in the…

Alexander Arendar
- 3,365
- 2
- 26
- 38
0
votes
1 answer
Call Twirl template in scala code
I have a Play Scala 2.5 application. I would like to know how to return Twirl template (if possible) inside another Twirl template from scala code.
Example : I have several Twirl templates corresponding to html input element. One template for…

jerome
- 2,029
- 4
- 38
- 58
0
votes
1 answer
How to create a variable inside of a play twirl template?
I have a model that I pass to my view that looks like:
IndexModel(productSales: Seq[ProductSale])
case class ProductSale(id: Int, name: String, soldAt: java.time.ZonedDateTime)
Now I want to display a list of the product sales, but I put a header…

Blankman
- 259,732
- 324
- 769
- 1,199
0
votes
2 answers
Playframework: how change the value of a twirl parameters without reload the entire page?
Supose I have a view that receive a list of things like that:
@(notices: Seq[Notice])
@for( not <- notices) {
not.title
}
....
and I have a method in a controller that its call by ajax and changes the values of the list. I know that…

Yohanna Lisnichuk
- 81
- 4
0
votes
1 answer
How to render java.util.Collection using Playframework template engine?
I just want to render a simple list. I followed official documentation but IntelliJ is showing an error. This is the code to display a ul list:
@import java.util
@(products: util.Collection[String])
-
@for(product <- products)
{
…

Prakash P
- 3,582
- 4
- 38
- 66
0
votes
1 answer
Playframework -> Twirl scala showing simple form
I have spent 3 days 48 hours trying to show simple login form. It is me being stupid or play being complicated.
Anyway I am getting error:
[error] login.scala.html:16: Expected ')' but found 'EOF'
[error] }
[error] ^
[error]…

Vladimir
- 23
- 3
0
votes
1 answer
Playframework 2.x (Scala): Passing a Twirl/HTML code from a controller's function to the view
My Aim: Learn the limitations (if any) on parameters that I can send from the controller to view. Right now, I'm checking if I can send any Twirl's keyword (e.g., @, @for, etc.) from the controller function to the view, and then reload a part of the…

o-0
- 1,713
- 14
- 29
0
votes
2 answers
How do you create a Scala collection of content in a Play template?
I'm sure I'm missing the obvious but is there a way to create a collection of Html objects to pass to a Play template like @(title: String)(content: Seq(Html))? I am trying to dynamically generate a group of tab pages where each Html object is the…

geeforce
- 15
- 3
0
votes
1 answer
How to add composite view like HashMap to twirl in playframework 2.4.x
I want to add a HashMap Object contains many different object(s) to the twirl template, because I do not like adding one by one as parameter to the twirl, it breaks the rule with design patterns.
the normal style:
views.html.index.render(object1,…

nikkofu
- 15
- 3
0
votes
1 answer
playframework with Twirl views not found: value
i pass a lot of time trying to solve very simple problem render à string or(List) from controller to view using playframework java and Twirl, my code here
in my controller
public Result list(){
//List todo =…

A.khalifa
- 2,366
- 3
- 27
- 40
0
votes
2 answers
create List inside twirl template
Usually I create all the stuff like that:
@(courses: List[models.Course])
Then I pass the List from the controller into the view from the render() method.
but this is some kind of special case, It's actually a partial and I would have to add the…

AME
- 2,262
- 6
- 19
- 39
0
votes
1 answer
Moving PlayFramework 2.4.x View Templates into a specific Package
I'm on IntelliJ 2.4.x and I'm trying to move the Twirl view template into a specific package (not the default package views.html). The reason for this is I have a sub project and I'd like to avoid clashing view names by namespacing the two sets of…

ronaldwidha
- 1,345
- 2
- 12
- 24
0
votes
0 answers
Play 2.4.x -- what are the most efficient type of Objects to place in a @Twirl template?
You can place many things inside a @Twirl template and obviously something is concatenating all of those things into a final output String (Html)
My question is are there any specific Object types (say something like StringBuilder) that are easier…

Techmag
- 1,383
- 13
- 24
0
votes
1 answer
Passing a Call without the Params to a Twirl template
In Play Framework (v 2.3.7) (scala 2.11.5) I wish to pass a Call to a twirl template but I won't be able to calculate the params until after the template loads.
The use case is pagination on a table (with constraints and user defined search…

Techmag
- 1,383
- 13
- 24
0
votes
1 answer
Using scala template code blocks and values as argument to template call (Play Framework)
I've tried to use both reusable code blocks and reusable values as argument to a function call (another template), but always end up in a compilation error: "illegal start of simple expression".
Let's say I have the header template, which takes a…

Blackbird
- 2,368
- 4
- 26
- 41