在我的gsp页面中是以下代码
<p>
${ confirmationTemplate?.body?.replace('\n', '<br/>') }
</p>
页面呈现如下
> Dear Participant, <br/> <br/>Thanks for registering to our event. The
> event will start shortly. <br/> <br/>Please collect your bibs before
> the race. <br/> <br/>Cheers, <br/>Swat Kats
&lt; BR /&GT;不应该打印,但这应该导致新线。我怎么解决这个问题?我感谢任何帮助!谢谢!
答案 0 :(得分:0)
请看这篇文章http://mrhaki.blogspot.ru/2013/11/grails-goodness-generating-raw-output.html
${raw(confirmationTemplate?.body?.replace('\n', '<br/>'))}
以上示例适用于grails版本&gt; 2.3
答案 1 :(得分:0)
<%request.setAttribute("vEnter", "\n");%>
${fn:replace(blindItem.blindShowModeStr,vEnter,"<BR />") }