我只想用<h:panelGroup>
<h:panelGroup rendered = "#{cc.attrs.value.id != sessionController.authUser.id}">
<div class = "userDetails">
Name: #{cc.attrs.value.name}
Details: #{cc.attrs.value.details}
</div>
</h:panelGroup>
<h:panelGroup rendered = "#{cc.attrs.value.id == sessionController.authUser.id}">
<div class = "userDetails">
<h:form>
...
</h:form>
</div>
</h:panelGroup>
另一种选择是使用 Seam ( <s:div>
) 或 Tomahawk ( <t:htmlTag>
) 库中的组件,如果您的项目中已经有它们的话。
请参阅: http: //www.jsftoolbox.com/documentation/seam/09-TagReference/seam-div.html
<s:div styleClass = "userDetails" rendered = "#{cc.attrs.value.id != sessionController.authUser.id}">
Name: #{cc.attrs.value.name}
Details: #{cc.attrs.value.details}
</s:div>
<s:div styleClass = "userDetails" rendered = "#{cc.attrs.value.id == sessionController.authUser.id}">
<h:form>
...
</h:form>
</s:div>
或者: http: //myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_htmlTag.html
<t:htmlTag value="div" styleClass = "userDetails" rendered = "#{cc.attrs.value.id != sessionController.authUser.id}">
Name: #{cc.attrs.value.name}
Details: #{cc.attrs.value.details}
</t:htmlTag>
<t:htmlTag value="div" styleClass = "userDetails" rendered = "#{cc.attrs.value.id == sessionController.authUser.id}">
<h:form>
...
</h:form>
</t:htmlTag>