1

I have a Scala Play web app that is pulling html variables from the database, then placing them inside of a template. Something like this

<div>@myvar</div>

Where my var is an html string. The myvar is not being recongized by the template engine as html. So I get an output something like this

<h3>MY HEADING</h3>

instead of the h3 tags being rendered by the Scala play template engine to a proper html H3 tag.

Where do I need to render these variables? I have tried to do it in my controller but have obviously failed.

Thanks!

1 Answer 1

5

You need to wrap it in an Html object, otherwise the html is escaped.

<div>@Html(myvar)</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.