具有绑定的facelet组合控件(自定义标签)

时间:2010-09-15 10:28:10

标签: jsf facelets icefaces custom-tag

我在创建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

1 个答案:

答案 0 :(得分:1)

发现问题! 问题的原因是 我有第二个冰:inputText控件绑定到相同的后端bean proberty。这似乎会导致JSF组件树生成出现很多问题。

我的错,但如果JSF提供任何提示或错误信息而不仅仅是表现得很奇怪,那仍然会很好......

相关问题