webtier@glassfish.java.net

Re: [webtier] f:ajax event attribute won't accept expression

From: Paulo Cesar Reis <casmeiron_at_gmail.com>
Date: Wed, 03 Jun 2009 01:49:57 -0300

Hi Jim, thanks for the answer.

Yes, that would be better but my composite component looks like this:
<composite:implementation>
        <h:panelGroup>
             <h:inputText id="someId" value="someValue" />
         </h:panelGroup>

</composite:implementation>

Whether I want to set the validators/convertors for component with id
"someId" I cannot use your example, right? Cause it will try to add them to
the panelGroup and this component isn't an EditableValueHolder so I think
isn't possible. That's why I created something like:
             <h:inputText id="someId" value="someValue">
                <!-- Validators for input BEGIN -->
                <c:if test="#{cc.attrs.validators!=null}">
                    <c:forEach
items="#{bsc:parseValidators(cc.attrs.validators)}"
                        var="validator">
                        <f:validator
validatorId='#{validator["validatorId"]}' >
                            <c:forEach items="#{validator}" var="param">
                                <c:if
test="#{validator.key!='validatorId'}">
                                    <f:param name="#{param.key}"
value="#{param.value}" />
                                </c:if>
                            </c:forEach>
                        </f:validator>
                        <br />
                    </c:forEach>
                </c:if>
           </h:inputText>

So with f:param I can do what I want but it doesn't work. Faces could have a
for attribute for components like converters and validators (<f:converter
converterId="someId" for="componentId" />) so I could attach them outside of
the component.

Hope you can help me :-)

Thanks.

On 6/3/09 1:14 AM, "Jim Driscoll" <Jim.Driscoll_at_Sun.COM> wrote:

>
>
> On 6/2/09 12:42 PM, Paulo Cesar Reis wrote:
>> Hi, thanks for the answer.
>>
>> I cannot use the simple way 'cause I'm creating a complex composite
>> application that automatically add validators for field. See my attached
>> sample.
>>
>> So I really need to use f:param (or something that can do what I need) for
>> validators and also for converters (whether available).
>
> Looking at your code, what it looks like is that you're passing the
> validators as an attribute to the component. Couldn't you instead add
> the attributes to the component itself? For example:
>
> in the using page,
>
> instead of :
>
> <comp:component validators=#{validatorList}/>
>
> do:
>
> <comp:component id="one">
> <f:validateLength for="two" minimum="3" maximum="5"/>
> </comp:component>
>
> Would that work? I haven't tested this (still at the conference), but
> if it will fulfill your need, I can see what's required to make that
> work (or, if pressed for time, you could try it and see).
>
> Jim
>
>
>> Thanks.
>>
>> On 6/2/09 1:38 PM, "Jim Driscoll"<Jim.Driscoll_at_Sun.COM> wrote:
>>
>>> Sorry I was so terse earlier - I was waiting for the train, and wasn't
>>> sure when I'd get to email again.
>>>
>>> But to answer the second part of your question:
>>>
>>>> On Jun 2, 2009, at 8:01 AM, Paulo Cesar Reis<casmeiron_at_gmail.com
>>>> <mailto:casmeiron_at_gmail.com>> wrote:
>>>>> Also I¹m wondering whether I can use f:param tag to define properties
>>>>> for validators, like:
>>>>> <f:validator validatorId=²javax.faces.Length²>
>>>>> <f:param name=²minimum² value=²1² />
>>>>> <f:param name=²maximum² value=²3² />
>>>>> </f:validator>
>>>>>
>>>>> Whether not, how can I accomplish the desired behavior?
>>> I'm not really sure what you're trying to do. Shouldn't
>>> <f:validateLength maximum="15" minimum="6"/> work?
>>>
>>> But, though I'm not 100% positive, I don't think validate handles
>>> params. But that isn't necessary in your example, is it?
>>>
>>> Jim
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>