在XHTML页面中包含另一个XHTML页面的最正确方法是什么?我一直在尝试不同的方式,但都没有.
我最近开始使用带有Facelets的JSF 2.0,并且对于了解<ui:include>Facelets 1.x提供的现有和其他模板技术的新复合组件感到困惑.
这些方法有什么区别?从功能上看,它们似乎提供了相同的:<ui:param>vs <cc:attribute>,<ui:insert>+ <ui:define>vs标记文件,重用现有模板.除了复合组件的语法和清晰的接口规范之外还有什么吗?性能会有所不同?
我在panelGrids中有很多outputLabel和inputText对
<h:panelGrid columns="2">
<h:outputLabel value="label1" for="inputId1"/>
<h:inputText id="inputId1/>
<h:outputLabel value="label2" for="inputId2"/>
<h:inputText id="inputId2/>
...
</h:panelGrid>
Run Code Online (Sandbox Code Playgroud)
我希望所有这些都有一些行为:比如每个inputText的相同验证或相同大小.所以我创建了一个复合组件,它只包含一个outputLabel和一个inputText
<my:editField value="field1"/>
<my:editField value="field2"/>
Run Code Online (Sandbox Code Playgroud)
但是现在当我将它们放在gridPanel中时,根据标签文本的长度,它们不会对齐.我理解为什么,但我不知道如何解决.
有没有办法只运行一个页面,以便我可以看到生成的html(和css),因为它会向用户看,即使它本质上是非功能性的?独立的JSF页面.我想回顾一下如何在实际编写表单字段之前设置表单以确定它们是否符合用户的观点.我正在使用maven和netbeans但不确定后者是否相关.
Facelets ui:composition和ui:decorateFacelets 之间有什么区别?两者似乎都支持ui:define儿童标签.在什么情况下你会使用这些?
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
...
template="inputLayout.xhtml">
<composite:interface>
<composite:attribute name="name" />
<composite:attribute name="value" />
</composite:interface>
<composite:implementation>
<!-- <ui:define name="content"> -->
<h:message for="textPanel" style="color:red;" />
#{cc.attrs.name} :
<h:inputText id="name" value="#{cc.attrs.value}" />
<!-- <ui:define> -->
</composite:implementation>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
问题是即使是ui:define也会对内容进行评论.所以它就像ui:define被忽略或者我错过了什么?谢谢.