struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cameron Ingram" <CIng...@pscu.net>
Subject RE: Form Bean
Date Mon, 05 Nov 2001 12:12:29 GMT
Doh!! Of course that is it. Sometimes it is the really small things that will catch you.

Thanks

>>> Karen.Prengaman@IGT.com 11/02/01 06:46PM >>>
Cameron, are you still experiencing this problem?  I just ran into the same
thing and thought I would share how I solved it.  

I too was creating a form bean and then adding it to the session.  When the
corresponding jsp was loaded, all the values were reset to the default.
Upon examining my struts-config.xml, I noticed the following in my action
mapping for that jsp:

Note: irrelevant attributes have been omitted
<action  path="/path"
         scope="request"
         name="formName"
         input="/form.jsp">
</action>

Notice the value of the scope attribute...  I decided to add my newly
created form bean as a request attribute instead of to the session, and my
problem was solved.  To confirm my suspicions, I changed the value of the
scope attribute to session and then saved my form bean in the session, and
it still worked.

Hope this helps.

-Karen

-----Original Message-----
From: Cameron Ingram [mailto:CIngram@pscu.net] 
Sent: Thursday, November 01, 2001 4:57 AM
To: struts-user@jakarta.apache.org 
Subject: Re: Form Bean


No... should I be? Ted could you enlighten us a bit on how to do this? :)
Am I  missing some thing? My code to do this consists of a few lines to do
this. I figure the problem is probably something pretty small.

Ex.
ActionForm frm = new ActionForm();
frm.setSomething("Something");
session.setAttribute("Form", form);

Thanks !! Cameron Ingram


>>> husted@apache.org 10/31/01 04:28PM >>>
When you create the ActionForm, are you calling setServlet()?

Cameron Ingram wrote:
> 
> Hi all!
> 
>  Ok here is the problem.... I have a form bean that I create in an action
class, I then set the variables in it and then add it to the session.
> This is before the corresponding jsp has been loaded  The jsp is loaded
and it appears that the action servlet is then recreating the form bean and
re-adding it to the session, thus all of the fields I set are set back to
there original values. I overrode the reset method so I know that it's not
calling that to clear the variables.  As I understand it the action servlet
should check to see if it's in the session before it recreates it. The name
I am using to define it in the session is the same name that the
struts-config file uses to define the name. Any ideas???
> 
> <form-bean name="editdeleteuserndsForm"  ->This is the name that I am
using when the form bean is added to the session.
>               type="net.pscu.ndswebutils.EditDeleteUserNdsForm"/>
> 
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

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



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

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



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


Mime
View raw message