tags:

views:

33

answers:

2

How to display value with HTML tag inside h:inputTextarea? In DB I have column contain data, it contain plain text and HTML tag, I want display it on h:inputTextarea. How can I do it?

A: 

Use the f:verbatim tag -> JSF Verbatim Tag

Abel Morelos
+1  A: 

i want display HTML inside h:inputTextArea it mean in DB contain <br/> or <b> and </b> , when it display on h:inputTextArea it must display bold or break line.

That's not possible due to the nature of HTML <textarea> element. Even, if it was possible this puts doors wide open to XSS injection attacks. Also, how would you ever let the enduser edit the markup in the textarea like changing bold to for example italics or to add another markup? That's plain impossible with a <textarea>.

If your sole intent is to have a rich text editor, then you need to homegrow one with help of a <div> and a good shot of JavaScript or, better, use an existing JSF component which achieves this. For example, PrimeFaces' <p:editor>.

Or, if your sole intent is to display it only, then use <h:outputText> with the escape attribute set to false. Once again, keep XSS risks in mind.

BalusC
@BalusC my TextArea only use for display Plaintext, i want display rule before use register, it look like when u register in VBulletin Board forum !
Kency
Then use `<h:outputText escape="false">` as suggested.
BalusC