i didn't realise the use of () for lists and [] for maps - i thought you always 
use []

 

i used input field names like    users(0).name  and now name gets set on the 
relevant object in the list - no need for any extra methods just the getUsers() 
setUsers() methods.

 

thanks all

 

adam


 
> Date: Sun, 12 Sep 2010 18:04:38 -0400
> Subject: Re: Array Input Fields
> From: davelnew...@gmail.com
> To: user@struts.apache.org
> 
> Look at the type conversion docs: there's a difference between using
> [] and () in the JSP names.
> 
> On Sunday, September 12, 2010, adam pinder <apin...@hotmail.co.uk> wrote:
> >
> >
> >
> > OP :-
> >
> >
> >
> > I thought when the input field name contained [] that struts effectively 
> > replaced them with () - so in my input field
> >
> >
> >
> > user[0].name
> >
> >
> >
> > for example, would become getUser(0).setName(...) etc..
> >
> >
> >
> > I checked the list object contains elements and it does (i retrieve them 
> > before the update page is displayed and stored in the session - the get/set 
> > of the list object accesses the session to retrieve the object), i also 
> > included a system out in the getUser(int occ) method and it never gets 
> > called so its not because the getUser(0) returns null or the list is null.
> >
> >
> >
> > i've had this before and i took the params off the request myself in the 
> > action and updated the list - just thought i'd try and get to the bottom of 
> > it this time.
> >
> >
> >
> > i think it must be down to the input names i'm using or the methods i need 
> > to have available to the params interceptor to call.
> >
> >
> >
> > adam
> >
> >
> >
> >> Date: Sat, 11 Sep 2010 19:52:48 -0400
> >> Subject: Re: Array Input Fields
> >> From: davelnew...@gmail.com
> >> To: user@struts.apache.org
> >>
> >> Depends. The OP wasn't using index notation (parens instead of
> >> brackets) so there'd need to be a getUsers.
> >>
> >> On Saturday, September 11, 2010, Chris Mawata
> >> <chris_mawata_str...@mathcove.net> wrote:
> >> >  On 9/10/2010 1:08 PM, adam pinder wrote:
> >> >
> >> > public User getUser(int occ)
> >> >
> >> >
> >> > Should the getter not return the collection rather than a single User?
> >> > Chris
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> > For additional commands, e-mail: user-h...@struts.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >>
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
                                          

Reply via email to