带绑定的 Facelet 组合控制(自定义标签)
我在创建 Facelet Composition Control(= 自定义标签)时遇到问题。
这是组件的模板 (numberinput.jspx)。我在我的 custom-taglib.xml 中声明了 。
到目前为止,包含工作使用此代码:
<ft:numberInput nullablenumber="true" cid="myId"
bind="#{myBean.mySpecialComponent}"
value="#{myBean.license.myProperty }"
label="My Label"/>
这就是模板:
<div id="c_#{cid}"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:ft="http://www.mycomp.com/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" style="overflow:auto" >
<ui:composition>
<ice:message for="#{cid}"></ice:message>
<ice:outputLabel for="#{cid}">#{label }</ice:outputLabel>
<ice:inputText
id="#{cid}"
value="#{value}"
style="#{style }"
required="false"
disabled="#{disabled }"
binding="#{ bind}"
>
<f:validator validatorId="notnull"/>
<f:converter converterId="nullableNumber"/>
</ice:inputText>
</ui:composition>
</div>
当我的页面上有多个这些标签时,我的问题就会出现。我觉得 Facelets 很困惑并且只显示其中的一组,这真的很奇怪。
我的代码有什么问题吗?或者 Facelets 是否像看起来那样有问题?
多谢。
根据我目前的经验,我只能阻止任何人使用 Facelets 自定义标签(至少在使用组件绑定时)。
环境信息:我正在使用 ICEFaces 1.8.2 和 Tomcat 6
I'm having problems with creating a Facelet Composition Control (= custom tag).
That's the component's template (numberinput.jspx). I declared the in my custom-taglib.xml.
So far the inclusion works using this code:
<ft:numberInput nullablenumber="true" cid="myId"
bind="#{myBean.mySpecialComponent}"
value="#{myBean.license.myProperty }"
label="My Label"/>
That's the template:
<div id="c_#{cid}"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:ft="http://www.mycomp.com/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" style="overflow:auto" >
<ui:composition>
<ice:message for="#{cid}"></ice:message>
<ice:outputLabel for="#{cid}">#{label }</ice:outputLabel>
<ice:inputText
id="#{cid}"
value="#{value}"
style="#{style }"
required="false"
disabled="#{disabled }"
binding="#{ bind}"
>
<f:validator validatorId="notnull"/>
<f:converter converterId="nullableNumber"/>
</ice:inputText>
</ui:composition>
</div>
My problems arise when I have multiple of these tags on my page. I seems like Facelets gets confused and displays only a set of these, it's really very odd.
Is there anything wrong with my code or is Facelets just as buggy as it seems?
Thanks a lot.
From my current experience I only can discourage anyone to use Facelets custom tags (at least when component binding is used).
Environment info: I'm using ICEFaces 1.8.2 and Tomcat 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现问题了!
出现问题的原因是
我有第二个ice:inputText 控件,它绑定到相同的后端bean 探测器。这似乎给 JSF 组件树生成带来了很多问题。
我的错,但如果 JSF 给出任何提示或错误消息而不是表现得很奇怪,那就太好了......
Problem found!
The reason for the problems were that
I had a second ice:inputText control which was bound to the same backend bean proberty. it seems like this causes a lot of problems for JSF component tree generation.
My fault but it still would be nice if JSF gives any hints or error messages instead of just acting weird...