JSF 2.0: h:inputText inside composite component fails with non-String objects when validation is set

前端 未结 1 919
南笙
南笙 2021-01-07 02:12

In a backing bean:

@Min(3)
Integer foo;

If I have form like:


    
         


        
相关标签:
1条回答
  • 2021-01-07 03:09

    As per a comment on your ticket, it turns out that you could as workaround explicitly specify the type converter.

    You could do it as follows

    <pref:fieldComponent text="#{bean.foo}">
        <f:converter converterId="javax.faces.Integer" />
    </pref:fieldComponent>
    

    and

    <cc:implementation>
        <h:inputText id="field" value="#{cc.attrs.text}">
            <cc:insertChildren />
        </h:inputText>
    </cc:implementation>
    

    or maybe

    <pref:fieldComponent text="#{bean.foo}" converter="javax.faces.Integer" />
    

    and

    <cc:implementation>
        <h:inputText id="field" value="#{cc.attrs.text}" converter="#{cc.attrs.converter}" />
    </cc:implementation>
    
    0 讨论(0)
提交回复
热议问题