how to convert raw br in gsp to break row?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 02:38:29

问题


In my gsp page is the following code

<p>

        ${ confirmationTemplate?.body?.replace('\n', '<br/>') }


    </p>

The page renders as follows

> 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

The < br/> should not be printed but that should cause new line. How can i solve this problem? I appreciate any help! Thanks!


回答1:


    <%request.setAttribute("vEnter", "\n");%>
    ${fn:replace(blindItem.blindShowModeStr,vEnter,"<BR />") }



回答2:


Look at this article http://mrhaki.blogspot.ru/2013/11/grails-goodness-generating-raw-output.html

 ${raw(confirmationTemplate?.body?.replace('\n', '<br/>'))}

The example above will work with grails version > 2.3



来源:https://stackoverflow.com/questions/43317231/how-to-convert-raw-br-in-gsp-to-break-row

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!