You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hubert Rabago <hr...@gmail.com> on 2006/03/06 17:22:59 UTC

Re: ActionForm with ArrayList and logic:iterate .... confusing problem ...

Hans,

You're using request scope for your form.  When Struts processes the
submitted form, it will create a new instance of your ActionForm.  The
question now is, is the new instance ready to deal with setting values
on your ArrayList field?  Struts will not instantiate that list for
you, it wouldn't know how to.  So make sure that when Struts accesses
your ActionForm, the ArrayList already exists.

Hubert

On 3/6/06, Hans-Peter Petek <pe...@mazda.at> wrote:
>
> Hello all,
>
> i have really a stupid problem with my actionform, i try to map a list of
> radio-buttons with my ArrayList in the ActionForm ... displaying it, is
> working, but after pressing the save-button (submitting the form) i get an
> Exception:
> [Servlet-Fehler]-[BeanUtils.populate]: java.lang.NullPointerException
>
> I´ve tried really a lot of thinks, i think that there is some getter/setter
> missing with an index ...? All properties has getter and setter methods ...
> but i think there should be some getter/setter more when using ArrayList ...
> or Lists in general.
>
> I have added the files ... i really hope that someone could help me ...
> because i think this can only be a small stupid mistake :-((
>
>
> struts-config ...
> <form-bean name="testForm"
> type="at.mazda.masters.forms.struts.TestForm"></form-bean>
>
>
> <action
>
> path="/test"
>
> type="at.mazda.masters.actions.struts.TestAction"
>
> scope="request"
>
> name="testForm"
>
> input="/test.jsp">
>
> <forward name="ok" path="test.jsp"></forward>
>
> </action>
>
> The other stuff is attached ... thanks a lot again for helping me!!!
>
> I think there is some getter/setter with index missing, but where the hell i
> get the information on how to set this ...?!?!
>
> thanks
>
> Hans-Peter
>
> PS: Only for your understanding - right in this case means ... privilege ...
> (not right, left) .... so, i have   a role with a lot of rights (list of
> privileges) which i want to display.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


AW: ActionForm with ArrayList and logic:iterate .... confusing problem ...

Posted by Hans-Peter Petek <pe...@mazda.at>.
Hello,

thank you very much - this was the error - its working now - I setted the
scope to "session" ... THANKS A LOT!!
But another question - this also means, that the data is stored in the
session - so the session-size is growing ... is there another solution,
because I think there is data in the session that is only needed for this
form - but if the user is doing something other - this data isn´t used any
more - but still in the session :-(

kind regards,
Hans

-----Ursprüngliche Nachricht-----
Von: Hubert Rabago [mailto:hrabago@gmail.com] 
Gesendet: Montag, 06. März 2006 17:23
An: Struts Users Mailing List
Betreff: Re: ActionForm with ArrayList and logic:iterate .... confusing
problem ...

Hans,

You're using request scope for your form.  When Struts processes the
submitted form, it will create a new instance of your ActionForm.  The
question now is, is the new instance ready to deal with setting values on
your ArrayList field?  Struts will not instantiate that list for you, it
wouldn't know how to.  So make sure that when Struts accesses your
ActionForm, the ArrayList already exists.

Hubert

On 3/6/06, Hans-Peter Petek <pe...@mazda.at> wrote:
>
> Hello all,
>
> i have really a stupid problem with my actionform, i try to map a list 
> of radio-buttons with my ArrayList in the ActionForm ... displaying 
> it, is working, but after pressing the save-button (submitting the 
> form) i get an
> Exception:
> [Servlet-Fehler]-[BeanUtils.populate]: java.lang.NullPointerException
>
> I´ve tried really a lot of thinks, i think that there is some 
> getter/setter missing with an index ...? All properties has getter and
setter methods ...
> but i think there should be some getter/setter more when using ArrayList
...
> or Lists in general.
>
> I have added the files ... i really hope that someone could help me ...
> because i think this can only be a small stupid mistake :-((
>
>
> struts-config ...
> <form-bean name="testForm"
> type="at.mazda.masters.forms.struts.TestForm"></form-bean>
>
>
> <action
>
> path="/test"
>
> type="at.mazda.masters.actions.struts.TestAction"
>
> scope="request"
>
> name="testForm"
>
> input="/test.jsp">
>
> <forward name="ok" path="test.jsp"></forward>
>
> </action>
>
> The other stuff is attached ... thanks a lot again for helping me!!!
>
> I think there is some getter/setter with index missing, but where the 
> hell i get the information on how to set this ...?!?!
>
> thanks
>
> Hans-Peter
>
> PS: Only for your understanding - right in this case means ... privilege
...
> (not right, left) .... so, i have   a role with a lot of rights (list of
> privileges) which i want to display.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org