Questions tagged [twirl]

The Play framework Scala template engine repackaged for stand-alone use.

146 questions
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…
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 Pandey
  • 2,238
  • 2
  • 26
  • 52
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,630
  • 12
  • 27
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…
0
votes
1 answer

Play Framework / Twirl Dynamically include templates

Use case: I have a route handling all requests at host:port/p route looks like the following: GET /p/*path controllers.Application.p(path: String) The p method gets some data and passes it right through to the view p: return…
Brian G
  • 185
  • 1
  • 9
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
  • 1,974
  • 3
  • 20
  • 35
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,092
  • 5
  • 17
  • 36
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,325
  • 1
  • 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,293
  • 11
  • 21
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,293
  • 11
  • 21
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,288
  • 4
  • 23
  • 39
0
votes
1 answer

Play framework - calling view from another view with parameters

I'm trying to call a main layout from a view (just like in docs ) but I get the error: [error] C:\Users\Marco\Documents\Devel\Java\DroversWeb\app\views\device\list.sca la.html:1: too many arguments for method apply:…
Marco
  • 1
  • 3
0
votes
1 answer

How to write rendered template output to file?

I'm using Twirl in a non-play sbt project, and defined a template: hello.scala.html

Welcome hello world

It generates a Scala file containing the following code: package html import play.twirl.api._ import…
Freewind
  • 177,284
  • 143
  • 381
  • 649
1 2 3
9
10