Well I thought that it'd be simpler to develop a reusable EL function if all
that the form submission is doing is adding an element to the collection.
(And other pages might need the same functionality.) The alternative is to
make an action method for every single time when this needs to happen
throughout the application...

So why doesn't this work? Where would you place an EL function if not in the
action attribute? Or can it be placed in the action attribute but I might've
just done something wrong?

The use case is I've added, say, a phone number to the list of phone numbers
for a user. The text field is the entered phone number, and the action
attribute of the form submission link is the EL function that adds this
element to the collection of existing phone numbers...does this make sense?



Volker Weber-5 wrote:
> 
> Why did you want to do this in a el function? Why not a action method?
> 
> Can you describe your usecase?
> 
> Regards,
>   Volker
> 
> 2007/1/23, lightbulb432 <[EMAIL PROTECTED]>:
>>
>> Now where would I use that function? I created a function and tried using
>> it
>> as the value of h:commandButton's action attribute (because I want it to
>> be
>> executed when that form is submitted), but I receive an error:
>>
>> Not a Valid Method Expression: #{prefix:add(collection,value)}
>>
>>
>>
>>
>> David Delbecq wrote:
>> >
>> > If you are using facelets, you can easily create additional EL function
>> > that you can call to add to your collections and end with something
>> like
>> > #{add(collection,value)}
>> >
>> > En l'instant précis du 01/19/07 17:34, lightbulb432 s'exprimait en ces
>> > termes:
>> >> If it's not something that's possible (though I hope it is) could some
>> of
>> >> you
>> >> please describe how you deal with such common cases of Collection
>> >> manipulation from JSF form field values?
>> >>
>> >>
>> >>
>> >> lightbulb432 wrote:
>> >>
>> >>> Can I add/remove an input field value to a collection using EL? e.g.
>> >>> "#{myBean.myCollection.add/remove}" or something like that? I'd hate
>> to
>> >>> have to create a special backing bean method for this when it's such
>> a
>> >>> simple and common thing that I'd have to do for so many collections.
>> >>>
>> >>> I could create a special tag or component, but I wouldn't even know
>> >>> where
>> >>> to begin...that's why it'd be really great if somebody has created
>> this
>> >>> functionality already (preferrably part of JSF).
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Add-to-and-remove-from-collection-tf3035146.html#a8514856
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Add-to-and-remove-from-collection-tf3035146.html#a8529354
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to