Mic*_*vin 3 java jsf facelets jsf-2
基本问题:
包含一个页面,其中包含具有组件ID的组件,多次无法完成.但是,我如何能够在包含页面的情况下引用该组件?
例:
included.xhtml
....
<h:form id="foo"/>
....
<!-- here i need reference to foo component of this page -->
Run Code Online (Sandbox Code Playgroud)
的index.xhtml
....
<ui:include src="included.xhtml" />
<ui:include src="included.xhtml" />
<ui:include src="included.xhtml" />
Run Code Online (Sandbox Code Playgroud)
随着ui:include
id将被复制.
您可以将参数传递给包含的xhtml并为您的ID添加前缀
<ui:include src="included.xhtml">
<ui:param name="idPrefix" value="myFormIdPrefix"/>
</ui:include>
Run Code Online (Sandbox Code Playgroud)
在包含的xhtml中
<h:form id="#{idPrefix}_foo"/>
Run Code Online (Sandbox Code Playgroud)
现在可以将id引用为 #{idPrefix}_foo
归档时间: |
|
查看次数: |
3720 次 |
最近记录: |