我们有一个共同的组件,其中按钮或复选框的数量和标签不同.我可以有一个共同的包含文件和传递参数可以变化.在包含文件中,有没有办法找到多少个输入参数,并根据该数据呈现多个按钮或复选框.
您可以使用<ui:param>
将参数传递给包含文件.
<ui:include src="/WEB-INF/includes/some.xhtml">
<ui:param name="number" value="3" />
</ui:include>
Run Code Online (Sandbox Code Playgroud)
参数值是在上述具体的实例中可作为#{number}
在some.xhtml
.
另一种方法是将include文件注册为文件中的标记.taglib.xml
文件:
<tag>
<tag-name>some</tag-name>
<source>/WEB-INF/tags/some.xhtml</source>
</tag>
Run Code Online (Sandbox Code Playgroud)
然后,您可以将参数指定为标记文件属性:
<my:some number="3" />
Run Code Online (Sandbox Code Playgroud)
这种方式也可以作为#{number}
内部使用some.xhtml
.
归档时间: |
|
查看次数: |
2622 次 |
最近记录: |