Wednesday, July 12, 2006

 

Add raw HTML tags on JSF page

Can you put the HTML <div> tag around the JSF tag as below?

<div>
<f:outputText value="Hello, the world!"/>
</div>


Apprently above code won't work. To add raw HTML tags on the JSF page, you need to include the escaped HTML page in the <f:verbatim> JSF tag.


<f:verbatim>&lt;div&gt;</f:verbatim>
<f:outputText value="Hello, the world!"/>
<f:verbatim>&lt;/div&gt;</f:verbatim>

Comments:
The following works:

<f:verbatim>
<div class="pageTitle">
</f:verbatim>
<h:outputText value="Hello, the world!"/>
<f:verbatim>
</div>
</f:verbatim>

It generates:
<div class="pageTitle">
Hello, the world!
</div>

Note that it's <h:outputText> not <f:outputText>.
 
for me it says that it has a error because the div tag doesnt end inside the verbatim tag :S
 
Post a Comment



<< Home