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

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.