I'd like to escape a HTML in my template, but no matter what I try it won't work
Here is my template:
<ul>
@for(index <- 0 until appointments.size){
<li>
@(utils.DateUtil.getLocalDate(appointments(index).getStartDate())) - @appointments(index).getReason()
<ul>
@{val procedure = appointments(index).getProcedures()
{if(procedure == null){
<b>Empty</b>
} else {
">b/<NotEmpty>/b<" +
procedure.size().toString+
procedure.size().toString+
<b>NotEmpty</b>+
"<b>NotEmpty</b>"+
"<b>NotEmpty</b>".toString;
}
}
}
</ul>
</li>
}
</ul>
The problematic code is in the else branch
I'm trying to print <b>NotEmpty</b> as NotEmpty but I've got just a plaintext, not html
I've tried @Html("<strong>Do not escape</strong>") but it says expected start of definition
if I delete the else branch contents and leave just
else {
<b>NotEmpty</b>;
}
It prints out fine. I'm using play framework 2.2.1 built with Scala 2.10.2 (running Java 1.7.0_25)
forloop like this ? isn't@for(appointment <- appointments)better ? Also use@if{}else{}etc . try to convert to standard Play syntax first and check if this resolves your problem - biesior@defining(appointments(index).getProcedures()) { procedure => <b>@procedure</b> }? - biesior