Using a Scala template within the Java Play framework 2.0, I want to output dynamic content as HTML encoded.
For example:
<script type="text/javascript">
$("#@field.getId()").fieldList({
data: "@myUnencodedData"
})
</script>
Are there built in methods to accomplish this?
By default, HTML is escaped for security reasons. To output HTML, you wrap it in the Html helper: @Html(myUnencodedData)
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.