i learning play framework , have seen in couple of tutorial videos people using @ before declarations.
for example, in index.html file:
@main
or @ message
what @
do? how used in html files? reminds me lot of $ in jquery.
in first case i.e. @entity
or @id
these java annotations - used in java classes different purposes (according destination). showing part of ebean model, check its docs see do, sample:
package models; import java.util.*; import javax.persistence.*; import com.avaje.ebean.model; import play.data.format.*; import play.data.validation.*; @entity public class task extends model { @id @constraints.min(10) public long id; @constraints.required public string name; public boolean done; @formats.datetime(pattern="dd/mm/yyyy") public date duedate = new date(); public static finder<long, task> find = new finder<long,task>(task.class); }
second at
used in twirl templates indicates named variable or beginning of dynamic statement in general i.e.:
<title>@pagetitle</title> <ul> @for((item, index) <- myitems.zipwithindex) { <li>item @index @item</li> } </ul>
where @pagetitle
, @index
, @item
= varaibles,
@for(...){ ... }
it's loop's block, observe myitems
dosen't require @
symbol, it's recognized scala argument)
it's described in twirl documentation
as can see @
char in both cases hasn't connection, has absolutely different meaning.
to better understanding first familiar linked twirl documentation, , play documentation in general. study several sample apps prepared play team, realize which.