Skip to main content

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

12 replies [Last post]
Anonymous

Hi all,

I am trying to create a simple composite component where user can customize
the ajax event:

But when I try to execute the page I get:
Event attribute could not be determined: #{cc.attrs.event}

And when I put the same expression inside a outputText the value is shown
correctly.

So does the f:ajax event attribute accepts expression?

Also I¹m wondering whether I can use f:param tag to define properties for
validators, like:

Whether not, how can I accomplish the desired behavior?

Thanks.
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Paulo Cesar Reis

With the example below it work but I keep getting severe error message:

SEVERE: /field_validator.xhtml @68,61 for="input" Unhandled by
MetaTagHandler for type javax.faces.validator.LengthValidator

Follow my code:

event="blur" label="First Name: " required="true">

// composite interface
...
...

// composite implementation
...
...

value="#{cc.attrs.value}">

Thanks.

On 6/3/09 11:44 AM, "Jim Driscoll" wrote:

> From the JSF 2 PDL docs for validator:
>
> for - If present, this attribute refers to the value of one of the
> exposed attached objects within the composite component inside of which
> this tag is nested.
>
> From your comment, it seems like you didn't realize it was there.
>
> Jim
>
> On 6/3/09 7:39 AM, Jim Driscoll wrote:
>>
>>
>> On 6/2/09 9:49 PM, Paulo Cesar Reis wrote:
>>> Hi Jim, thanks for the answer.
>>>
>>> Yes, that would be better but my composite component looks like this:
>>>
>>>
>>>
>>>

>>>
>>>

>>
>>
>> If you have a using page of
>>
>>
>>

>>
>> and a component of:
>>
>>
>>
>>
>>

>>

>>
>> Then it should work, and not attach to the panelgroup, but the
>> inputText. I think. I'm not sure, and I don't know if I'll have time to
>> test it today - I'd have already written the sample code if I was back
>> at my desk, but being on the road makes it more difficult.
>>
>>> So with f:param I can do what I want but it doesn't work.
>>
>> Right, because that use of f:param isn't supported by JSF - f:param is
>> defined on an on component basis, and we haven't really had anyone ask
>> for this before now.
>>
>>> Faces could have a
>>> for attribute for components like converters and validators ( >>> converterId="someId" for="componentId" />) so I could attach them
>>> outside of
>>> the component.
>>
>> I'm not sure what you mean here, since that's exactly what I was getting
>> at in my last mail - maybe I wasn't clear.
>>
>> If I get a chance, I'll try and code something today, though I might
>> take until tomorrow night to get it done, based on availability. Or, as
>> I said before, you could always give it a go and let me know if it works
>> - I don't think we've tried this before, but I think it should work.
>>
>>
>> Jim
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Ryan Lubke

On 6/3/09 7:39 AM, Jim Driscoll wrote:
>
>
> On 6/2/09 9:49 PM, Paulo Cesar Reis wrote:
>> Hi Jim, thanks for the answer.
>>
>> Yes, that would be better but my composite component looks like this:
>>
>>
>>
>>

>>
>>

>
>
> If you have a using page of
>
>
>

>
> and a component of:
>
>
>
>
>

>

The for attribute should be referring to a named reference in the
composite interface, so
you'll need to expose the possible validator targets using the
composite:interface:



>
> Then it should work, and not attach to the panelgroup, but the
> inputText. I think. I'm not sure, and I don't know if I'll have time
> to test it today - I'd have already written the sample code if I was
> back at my desk, but being on the road makes it more difficult.
>
>> So with f:param I can do what I want but it doesn't work.
>
> Right, because that use of f:param isn't supported by JSF - f:param is
> defined on an on component basis, and we haven't really had anyone ask
> for this before now.
>
>> Faces could have a
>> for attribute for components like converters and validators
>> ( >> converterId="someId" for="componentId" />) so I could attach them
>> outside of
>> the component.
>
> I'm not sure what you mean here, since that's exactly what I was
> getting at in my last mail - maybe I wasn't clear.
>
> If I get a chance, I'll try and code something today, though I might
> take until tomorrow night to get it done, based on availability. Or,
> as I said before, you could always give it a go and let me know if it
> works - I don't think we've tried this before, but I think it should
> work.
>
>
> Jim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Paulo Cesar Reis

Yeah, that worked for me. Problem Solved, without f:param.

Thanks Ryan and Jim for your time.

On 6/3/09 12:37 PM, "Ryan Lubke" wrote:

>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Paulo Cesar Reis

Hi,

Thanks for the answer.

The issue has been reported at
https://glassfish.dev.java.net/issues/show_bug.cgi?id=8470

Thanks.

On 6/2/09 12:26 PM, "Jim Driscoll" wrote:

>> I am trying to create a simple composite component where user can customize
>> the ajax event:
>> >> />
>>
>> But when I try to execute the page I get:
>> Event attribute could not be determined: #{cc.attrs.event}
>>
>> And when I put the same expression inside a outputText the value is shown
>> correctly.
>>
>> So does the f:ajax event attribute accepts expression?

[att1.html]

Jim Driscoll

This sounds like a bug. Could you file it? We're all at JavaOne this
week.

Sent from my iPhone

On Jun 2, 2009, at 8:01 AM, Paulo Cesar Reis
wrote:

> Hi all,
>
> I am trying to create a simple composite component where user can
> customize the ajax event:
> > execute="@this" />
>
> But when I try to execute the page I get:
> Event attribute could not be determined: #{cc.attrs.event}
>
> And when I put the same expression inside a outputText the value is
> shown correctly.
>
> So does the f:ajax event attribute accepts expression?
>
> Also I’m wondering whether I can use f:param tag to define propertie
> s for validators, like:
>
>
>
>

>
> Whether not, how can I accomplish the desired behavior?
>
> Thanks.
[att1.html]

Jim Driscoll

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 > > wrote:
>> Also I’m wondering whether I can use f:param tag to define properties
>> for validators, like:
>>
>>
>>
>>

>>
>> Whether not, how can I accomplish the desired behavior?

I'm not really sure what you're trying to do. Shouldn't
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@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Paulo Cesar Reis

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).

Thanks.

On 6/2/09 1:38 PM, "Jim Driscoll" 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 >> > wrote:
>>> Also I¹m wondering whether I can use f:param tag to define properties
>>> for validators, like:
>>>
>>>
>>>
>>>

>>>
>>> Whether not, how can I accomplish the desired behavior?
>
> I'm not really sure what you're trying to do. Shouldn't
> 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@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

[fparam_for_validators.txt]
---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Jim Driscoll

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 :

do:



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" 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 >>> > wrote:
>>>> Also I¹m wondering whether I can use f:param tag to define properties
>>>> for validators, like:
>>>>
>>>>
>>>>
>>>>

>>>>
>>>> Whether not, how can I accomplish the desired behavior?
>> I'm not really sure what you're trying to do. Shouldn't
>> 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@glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Paulo Cesar Reis

Hi Jim, thanks for the answer.

Yes, that would be better but my composite component looks like this:



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:


items="#{bsc:parseValidators(cc.attrs.validators)}"
var="validator">
validatorId='#{validator["validatorId"]}' >

test="#{validator.key!='validatorId'}">
value="#{param.value}" />






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 ( 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" 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 :
>
>
>
> do:
>
>
>
>

>
> 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" 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 >>>> > wrote:
>>>>> Also I¹m wondering whether I can use f:param tag to define properties
>>>>> for validators, like:
>>>>>
>>>>>
>>>>>
>>>>>

>>>>>
>>>>> Whether not, how can I accomplish the desired behavior?
>>> I'm not really sure what you're trying to do. Shouldn't
>>> 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@glassfish.dev.java.net
>>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Jim Driscoll

On 6/2/09 9:49 PM, Paulo Cesar Reis wrote:
> Hi Jim, thanks for the answer.
>
> Yes, that would be better but my composite component looks like this:
>
>
>
>

>
>

If you have a using page of


and a component of:





Then it should work, and not attach to the panelgroup, but the
inputText. I think. I'm not sure, and I don't know if I'll have time
to test it today - I'd have already written the sample code if I was
back at my desk, but being on the road makes it more difficult.

> So with f:param I can do what I want but it doesn't work.

Right, because that use of f:param isn't supported by JSF - f:param is
defined on an on component basis, and we haven't really had anyone ask
for this before now.

> Faces could have a
> for attribute for components like converters and validators ( > converterId="someId" for="componentId" />) so I could attach them outside of
> the component.

I'm not sure what you mean here, since that's exactly what I was getting
at in my last mail - maybe I wasn't clear.

If I get a chance, I'll try and code something today, though I might
take until tomorrow night to get it done, based on availability. Or, as
I said before, you could always give it a go and let me know if it works
- I don't think we've tried this before, but I think it should work.

Jim

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Jim Driscoll

From the JSF 2 PDL docs for validator:

for - If present, this attribute refers to the value of one of the
exposed attached objects within the composite component inside of which
this tag is nested.

From your comment, it seems like you didn't realize it was there.

Jim

On 6/3/09 7:39 AM, Jim Driscoll wrote:
>
>
> On 6/2/09 9:49 PM, Paulo Cesar Reis wrote:
>> Hi Jim, thanks for the answer.
>>
>> Yes, that would be better but my composite component looks like this:
>>
>>
>>
>>

>>
>>

>
>
> If you have a using page of
>
>
>

>
> and a component of:
>
>
>
>
>

>

>
> Then it should work, and not attach to the panelgroup, but the
> inputText. I think. I'm not sure, and I don't know if I'll have time to
> test it today - I'd have already written the sample code if I was back
> at my desk, but being on the road makes it more difficult.
>
>> So with f:param I can do what I want but it doesn't work.
>
> Right, because that use of f:param isn't supported by JSF - f:param is
> defined on an on component basis, and we haven't really had anyone ask
> for this before now.
>
>> Faces could have a
>> for attribute for components like converters and validators ( >> converterId="someId" for="componentId" />) so I could attach them
>> outside of
>> the component.
>
> I'm not sure what you mean here, since that's exactly what I was getting
> at in my last mail - maybe I wasn't clear.
>
> If I get a chance, I'll try and code something today, though I might
> take until tomorrow night to get it done, based on availability. Or, as
> I said before, you could always give it a go and let me know if it works
> - I don't think we've tried this before, but I think it should work.
>
>
> Jim
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net

Paulo Cesar Reis

Hi Jim, thanks again.

Yeah, I probably miss that, sorry, I'm gonna try it :-)

Thanks.

On 6/3/09 11:44 AM, "Jim Driscoll" wrote:

> From the JSF 2 PDL docs for validator:
>
> for - If present, this attribute refers to the value of one of the
> exposed attached objects within the composite component inside of which
> this tag is nested.
>
> From your comment, it seems like you didn't realize it was there.
>
> Jim
>
> On 6/3/09 7:39 AM, Jim Driscoll wrote:
>>
>>
>> On 6/2/09 9:49 PM, Paulo Cesar Reis wrote:
>>> Hi Jim, thanks for the answer.
>>>
>>> Yes, that would be better but my composite component looks like this:
>>>
>>>
>>>
>>>

>>>
>>>

>>
>>
>> If you have a using page of
>>
>>
>>

>>
>> and a component of:
>>
>>
>>
>>
>>

>>

>>
>> Then it should work, and not attach to the panelgroup, but the
>> inputText. I think. I'm not sure, and I don't know if I'll have time to
>> test it today - I'd have already written the sample code if I was back
>> at my desk, but being on the road makes it more difficult.
>>
>>> So with f:param I can do what I want but it doesn't work.
>>
>> Right, because that use of f:param isn't supported by JSF - f:param is
>> defined on an on component basis, and we haven't really had anyone ask
>> for this before now.
>>
>>> Faces could have a
>>> for attribute for components like converters and validators ( >>> converterId="someId" for="componentId" />) so I could attach them
>>> outside of
>>> the component.
>>
>> I'm not sure what you mean here, since that's exactly what I was getting
>> at in my last mail - maybe I wasn't clear.
>>
>> If I get a chance, I'll try and code something today, though I might
>> take until tomorrow night to get it done, based on availability. Or, as
>> I said before, you could always give it a go and let me know if it works
>> - I don't think we've tried this before, but I think it should work.
>>
>>
>> Jim
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
>> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: webtier-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: webtier-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: webtier-help@glassfish.dev.java.net