Data</span>\");" />
开发者

Is there a tag like verbatim, except you can set it to dirty?

开发者 https://www.devze.com 2023-02-05 19:42 出处:网络
What I would like is something like following: <f:verbatim> <% out.println(\"<span id=\'test\'>Data</span>\");

What I would like is something like following:


<f:verbatim>
<%
out.println("<span id='test'>Data</span>");
%>
</f:verbatim>

I would like the out.println code to be rerun by ajax. However, when I set that form to dirty, the out.println is not rerun.

Is there a way around this, short of using a custom tag?

Wh开发者_如何学运维at I need is a tag, like


<f:writeAsHTML value="#{bean.HTMLproducer}"/>

Is there already a tag like that in myfaces or basic JSF?


Just put it in f:verbatim without that scriptlet

<f:verbatim>
    <span id="test">Data</span>
</f:verbatim>

Or just print it plain (only possible on JSF 1.2 or newer)

<span id="test">Data</span>

Or use h:outputText since it renders a <span> anyway

<h:outputText id="test" value="Data" />

Or use h:outputText escape="false" if the HTML comes from a bean property

<h:outputText value="#{bean.html}" escape="false" />

As per your functional requirement which reads like

I would like the out.println code to be rerun by ajax

The problem needs to be solved elsewhere. Are you using JSF 1.x or 2.x? Regardless, you should utilize JSF-provided Ajax components like RichFaces' Ajax4jsf components or JSF 2.0's <f:ajax> components which offers a render attribute to trigger re-rendering of JSF components.

0

精彩评论

暂无评论...
验证码 换一张
取 消