Archive | May, 2011

Print variables without escaped HTML in Play! framework

15 May

I just realized that when I was trying to embed the youtube videos on HTML I was getting the frame objects as

Check the quotes in src=”"”", I wanted to remove that. After some googling I found how to do that in Play! Framework.
Here are the two ways :-

a.) use raw().
for example, the URL value to render is src=”${video.get(“url”)}”, the use src=${video.get(“url”).raw()}

b.) use #verbatim tag
for example, the URL value to render is src=”${video.get(“url”)}”, the use src=#{verbatim}${video.get(“url”)}#{/verbatim}

and you are good to go :) . The result now would be

Follow

Get every new post delivered to your Inbox.