f:verbatim
不用那个scriptlet就行了
<f:verbatim>
<span id="test">Data</span>
</f:verbatim>
或者直接打印出来(仅适用于 JSF 1.2 或更新版本)
<span id="test">Data</span>
或者使用h:outputText
,因为它<span>
无论如何都会呈现
<h:outputText id="test" value="Data" />
或者h:outputText escape="false"
如果 HTML 来自 bean 属性,则使用
<h:outputText value="#{bean.html}" escape="false" />
根据您的功能要求,如下所示
我希望 ajax 重新运行 out.println 代码
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.