简体   繁体   English

如何在grails中将ag:textArea的内容设置为HTML(格式化文本,而非代码)

[英]How to set the content of a g:textArea as HTML (formatted text, not code) in grails

I have a small grails app which I am in the middle of writing. 我有一个编写中的Grails小应用程序。

In one action, the show, the 'show.gsp' page is called, in which is a text area: 在一个动作中,显示被称为“ show.gsp”页面,其中是文本区域:

As shown in 'value', the value is to be some formatted text (ie, HTML) such as: 如“值”所示,该值将是一些格式化的文本(即HTML),例如:

<p>Writing some html </p>
<p>we can <strong>bold</strong> it</p>
<p>and <em>italic</em> it</p>
<p>and send it!</p>
<p>sean</p>
<p> </p>

However, instead of showing up as: 但是,与其显示为:

Writing some html 写一些html

we can bold it 我们可以加粗

and italic it 斜体

and send it! 并发送!

sean 肖恩


the HTML is shown as code (I assume the html is being escaped, even though i've set the attribute escapeHtml="false". HTML显示为代码(即使我已经设置了属性escapeHtml =“ false”,我也认为html正在被转义。

Or, do I have it wrong? 还是我错了? How else can I insert the HTML into a textArea as formatted text? 还有什么其他方法可以将HTML作为格式化文本插入到textArea中?

Thanks! 谢谢!

sean 肖恩

With textarea you can't. 使用textarea不能。 Try to use WYSIWYG editors like CKEditor 尝试使用所见即所得的编辑器,例如CKEditor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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