This question already has an answer here:
I am using JSF 1.2
I am trying to print text using <h:outputtext>
<h:outputText id="warningDose" styleClass="redText" value="#{templatePrescriptionMaintenanceBackingBean.doseWarningText}"></h:outputText>
Now this variable contains text with html tags. <b>
,<i>
etc...
But that displays content as it is instead of actual bold or italic html output.
Is there any way we can make this <h:outputText>
such that it gives html response?
Just set it to not escape.
You should set in the h:outputText tag:
But remember that mixing "view" construction (i.e., creating a string with HTML tags) between the JSF view page and the underlying bean is kinda bad practice. All the "view production" should be in the view page.
I had a very similar problem. My question is here
My xhtml page looks like -
associatedCode is getting value from a SQL query where I want to use HTML tag to have conditional styling.
Here is my SQL query looks like:
Ignore REPLACE and WM_CONCAT as it is for displaying comma separated values. The piece of code relevant is
I want to have tag based on a condition rmvd = 0.. Since, I have escape="false" in my , I don't need to escape my html tags in query. What I mean is no need to convert < to < > to > and " to "
Also note that since I have double quotes "" in my span, I need to escape it once so it won't be escaped when it reaches .
I am getting my output as desired - 8000778 in red color