我有两个JSF 1.2页面(one.xhtml和other.xhtml),
它们被以下规则包含到当前页面中:
...
<c:if test="#{flowScope.Bean.param1}">
<ui:include src="one.xhtml"/>
</c:if>
<c:if test="#{!flowScope.Bean.param1}">
<ui:include src="other.xhtml"/>
</c:if>
...
只要one.xhtml
和other.xhtml
之间仅通过操作参数不同:
one.xhtml:<h:commandLink action="actionOne">
other.xhtml:<h:commandLink action="actionTwo">
是否可能使用一些通用的xhtml?
而不是像one.xhtml和other.xhtml那样,类似于这样:
...
<c:if test="#{flowScope.Bean.param1}">
<ui:include src="general.xhtml" param="actionOne"/>
</c:if>
<c:if test="#{!flowScope.Bean.param1}">
<ui:include src="general.xhtml" param="actionTwo"/>
</c:if>
...
感谢你的帮助。
#{bean.doSomething}
而不是actionOne
,那么您确实需要获取JSF 2.0组合组件。 - BalusC<ui:param>
时是的。这不是什么秘密。但是对于<f:param>
不适用,它将始终转换为字符串。也许你最初的困惑是基于此的。 - BalusCf:param
及其与ui:param
的比较。我以前从未使用过f
库版本,现在会记住它们之间的区别。 - Adam