You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by De...@ak.blm.gov on 2005/07/14 20:54:04 UTC

[xh]:outputLabel body content vs. value att.

Is the body content of x:outputLabel equivalent to the value attribute? 

Below are two blocks of code.  In the first, the label is specified via 
the tag body; in the second, the value attribute.  Notice (see attached 
image) the different output from the message elements once validation 
fails.  When specifing the value of the label via the body content, the 
message detail (first arg) suggests that the label of the associated 
component is confused with it's id.  The label itself (second arg) is 
empty.  This happens if you move all the inputText and outputLabel tags to 
the core libs as well.

        <f:view>
           <h:form>

                <!-- using the body content -->
                <x:outputLabel for="field1" >BigDecimal 1</x:outputLabel>
                <!-- this prop. is a BigDecimal -->
                <x:inputText id='field1'
                        value="#{waterbdyBacker.unit.wbAreaMeas}" >
                        <f:validateLength minimum="0" maximum="9999"/>
                </x:inputText>
                <x:message 
                        for="field1" 
                        detailFormat="arg0={0} arg1={1}" />
 
                <f:verbatim><br/></f:verbatim> 
 
                <!-- using the value att. -->
                <x:outputLabel for="field2" value="BigDecimal 2"/>
                <!-- this prop. is a BigDecimal -->
                <x:inputText id='field2'
                        value="#{waterbdyBacker.unit.wbAreaMeas}" >
                        <f:validateLength minimum="0" maximum="9999"/>
                </x:inputText>
                <x:message 
                        for="field2" 
                        detailFormat="arg0={0} arg1={1}" />
 
                <f:verbatim><br/></f:verbatim>
                <h:commandButton value="Save" action="success" />
 
           </h:form>
        </f:view>