Black Cid
Black Cid

Reputation: 446

JavaServerFaces 2, returning html by ajax

<h:inputText value="#{finder.valor}" title="Test" id="valor"/>
<h:commandButton value="Search">
    <f:ajax execute="valor" render="output"/>
</h:commandButton>
<br/>
<h:outputText id="output" value="#{finder.find}"/>

I wanna do an ajax interactive finder, this finder returns a list of elements (<li>Element1</li><li>Element2</li>...)

There is any way to read that htmlTags in the outputText? Because now it appears like plain text.

Thank you.

Upvotes: 0

Views: 35

Answers (1)

Menno
Menno

Reputation: 12621

I'm not sure whether your question is the following:

How to output HTML-tags with JSF?

Assuming it is, try this:

<h:outputText id="output" value="#{finder.find}" escape="false" />

By default JSF will escape all codes. However, you can disable it with escape="false".

Upvotes: 2

Related Questions