简体   繁体   中英

domain class property representation on the page

I have a domain class with property which stores HTML text. I want to show this HTML directly on the page, so I want to use it in such way:

<head>
..
</head>
<body>
   ${instance.HTML}
</body>

suppose instance.HTML equals to <a>some text</a> what I get is:

<head>
..
</head>
<body>
   "<a>some text</a>"
</body>

but what I actually want to achieve is just

<head>
..
</head>
<body>
   <a>some text</a>
</body>

How to delete those quotes? Thanks!

This is happening because of security feature of grails: Cross Site Scripting (XSS) Prevention

Try raw like

${raw(instance.HTML)}

OR

add page directive like:

<%@page defaultCodec="none" %>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM