Re: Request bean is lost
[EMAIL PROTECTED] wrote: I have an action Page.do that gets 3 lists from a database. It then places the lists inside a bean which is set in the request. The Page.jsp iterates thru the bean to display the data. The form is posted to the PageSubmit.do. But before the PageForm.validate() is executed. Assume that an error is found... The response is returned And this is where my bean is lost. Why? (As mentioned your form bean won't be lost but the lists you put into the request would be. That's the nature of the request/response lifecycle). I do not want to store thr bean in the HTTP Session. This is why I'm not so fond of the way Struts handles default validation with the validation framework - this problem comes up all the time in an application. In a case like this, I would opt for not having validate="true" in your config file for this action, and in instead manually call the validate method in your action. Then if validation fails you can make a query to yoru dao to return your Lists and forward back to the page. Probably best if you had a setUp() method in your Action which can be called to do this setup. You'd call it of course the first time you need to present the form, and then after manually calling the validate() method on the form, and validation fails, you'd call it again. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
Since Struts forwards (not redirects) to the url defined in the input attribute upon validation failure (assuming validate is set to true), then nothing is lost in the request; and therefore the user input is not lost. robert > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 4:04 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > My lists are specific to each user based on security attributes obtained > from the database. > Therefore, the application scope solution is not acceptable for these > lists. > > If I go the first solution route, then I have my 3 Lists as part of the > Form bean. > The user selects from the list and submits the data. > If I set the imput to /Page.do wouldn't I lose the user's input? > > - Glenn > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > 06/07/2004 02:39 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > One solution is to point the input attribute value of the PageSubmit.do > action mapping > to the Page.do action mapping thus re-retrieving the lists before > displaying the page. > > An alternative solution is to override the reset() of your action form so > that it > retrieves the lists from the database and places them in the appropriate > scope. > > If the lists are composed of static data, you might consider retrieving > them on > application start up and placing them in application scope > (ServletContext) where > they will be available to all requests and then there would be no need to > retrieve > them each time the page is displayed. > > robert > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:39 PM > > To: [EMAIL PROTECTED] > > Subject: Request bean is lost > > > > > > Greetings, > > > > I have an action Page.do that gets 3 lists from a database. > > It then places the lists inside a bean which is set in the request. > > The Page.jsp iterates thru the bean to display the data. > > > > The form is posted to the PageSubmit.do. > > But before the PageForm.validate() is executed. > > Assume that an error is found... > > The response is returned > > > > And this is where my bean is lost. > > Why? > > > > I do not want to store thr bean in the HTTP Session. > > > > TIA, > > Glenn. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:45 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > :) > > I was just contemplating while browsing the code... > Getting the the data from the DB requires lots of work such > as setting a > Transfer Object, calling a Facade and the error handling > should the DB > return an error. > > If this still out weighs the use of a Session Bean then so be > it I will > code it. > Using a hidden value to indicate the first time is also an option. fwiw, a rule of thumb I use, is that if the page is a form, everything goes into the form bean, otherwise everything goes into request as is (ie no super bean). Since I use tiles, and make sure that all forms are set up by an action this is pretty easy to do. Even when i don't have things nicely partitioned that way, I still try to keep to it. Makes problems like this much easier, since the form bean will handle itself correctly for error conditions. > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > 06/07/2004 04:40 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > Let me clarify the last statement: > > Page.do will write over any input values to which it is > programmed to write. > > ...more eloquently stated by Jim > > "It shouldn't... unless you are overwriting those fields in page.do > explicitly." > > robert > > > -Original Message- > > From: Robert Taylor [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 4:37 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > Yes, it will write over any input values... > > > > In this case, you might want to consider populating > > the lists in the forms.reset() as mentioned earlier. > > > > ...not my prefered approach as it puts business logic > > in the form; its more of a work around. > > > > > > robert > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 4:23 PM > > > To: Struts Users Mailing List > > > Subject: RE: Request bean is lost > > > > > > > > > Umh... > > > Let me try to express myself more clearly! > > > > > > Page.do > > > - > > > My Page.do obtains 3 lists from the DB based on the > user's security > > > attributes. > > > Default values are set for 2 of the lists such as month and year. > > > All of this is done in the Form Bean. > > > > > > > > > PageSubmit.do > > > --- > > > The user selects a diffierent month other than the > default and submits > the > > > request to PageSubmit.do > > > > > > The input for the PageSubmit.do mapping is /Page.do > > > So this means that all of the Page.do logic is done again? > > > Won't this overwrite what the user has entered? > > > > > > > > > > > > > > > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > > > 06/07/2004 04:16 PM > > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > > > > > > > To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > > > cc: > > > > > > Subject:RE: Request bean is lost > > > Classification: > > > > > > > > > > > > > > > > -Original Message- > > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > > Sent: Tuesday, July 06, 2004 1:04 PM > > > > To: Struts Users Mailing List > > > > Subject: RE: Request bean is lost > > > > > > > > > > > > My lists are specific to each user based on security > > > > attributes obtained > > > > from the database. > > > > Therefore, the application scope solution is not acceptable for > these > > > > lists. > > > > > > > > If I go the first solution route, then I have my 3 Lists as > > > > part of the &g
RE: Request bean is lost
:) I was just contemplating while browsing the code... Getting the the data from the DB requires lots of work such as setting a Transfer Object, calling a Facade and the error handling should the DB return an error. If this still out weighs the use of a Session Bean then so be it I will code it. Using a hidden value to indicate the first time is also an option. "Robert Taylor" <[EMAIL PROTECTED]> 06/07/2004 04:40 PM Please respond to "Struts Users Mailing List" To: "Struts Users Mailing List" <[EMAIL PROTECTED]> cc: Subject:RE: Request bean is lost Classification: Let me clarify the last statement: Page.do will write over any input values to which it is programmed to write. ...more eloquently stated by Jim "It shouldn't... unless you are overwriting those fields in page.do explicitly." robert > -Original Message- > From: Robert Taylor [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 4:37 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > Yes, it will write over any input values... > > In this case, you might want to consider populating > the lists in the forms.reset() as mentioned earlier. > > ...not my prefered approach as it puts business logic > in the form; its more of a work around. > > > robert > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 4:23 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > Umh... > > Let me try to express myself more clearly! > > > > Page.do > > - > > My Page.do obtains 3 lists from the DB based on the user's security > > attributes. > > Default values are set for 2 of the lists such as month and year. > > All of this is done in the Form Bean. > > > > > > PageSubmit.do > > --- > > The user selects a diffierent month other than the default and submits the > > request to PageSubmit.do > > > > The input for the PageSubmit.do mapping is /Page.do > > So this means that all of the Page.do logic is done again? > > Won't this overwrite what the user has entered? > > > > > > > > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > > 06/07/2004 04:16 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > cc: > > > > Subject:RE: Request bean is lost > > Classification: > > > > > > > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 1:04 PM > > > To: Struts Users Mailing List > > > Subject: RE: Request bean is lost > > > > > > > > > My lists are specific to each user based on security > > > attributes obtained > > > from the database. > > > Therefore, the application scope solution is not acceptable for these > > > lists. > > > > > > If I go the first solution route, then I have my 3 Lists as > > > part of the > > > Form bean. > > > The user selects from the list and submits the data. > > > If I set the imput to /Page.do wouldn't I lose the user's input? > > > > No, the input param in struts-config.xml is expressly used for the case > > where validation fails. So you > > won't lose anything. > > > > > > > > - Glenn > > > > > > > > > > > > > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > > > 06/07/2004 02:39 PM > > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > > cc: > > > > > > Subject:RE: Request bean is lost > > > Classification: > > > > > > > > > One solution is to point the input attribute value of the > > > PageSubmit.do > > > action mapping > > > to the Page.do action mapping thus re-retrieving the lists before > > > displaying the page. > > > > > > An alternative solution is to override the reset() of your &
RE: Request bean is lost
Let me clarify the last statement: Page.do will write over any input values to which it is programmed to write. ...more eloquently stated by Jim "It shouldn't... unless you are overwriting those fields in page.do explicitly." robert > -Original Message- > From: Robert Taylor [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 4:37 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > Yes, it will write over any input values... > > In this case, you might want to consider populating > the lists in the forms.reset() as mentioned earlier. > > ...not my prefered approach as it puts business logic > in the form; its more of a work around. > > > robert > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 4:23 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > Umh... > > Let me try to express myself more clearly! > > > > Page.do > > - > > My Page.do obtains 3 lists from the DB based on the user's security > > attributes. > > Default values are set for 2 of the lists such as month and year. > > All of this is done in the Form Bean. > > > > > > PageSubmit.do > > --- > > The user selects a diffierent month other than the default and submits the > > request to PageSubmit.do > > > > The input for the PageSubmit.do mapping is /Page.do > > So this means that all of the Page.do logic is done again? > > Won't this overwrite what the user has entered? > > > > > > > > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > > 06/07/2004 04:16 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > cc: > > > > Subject:RE: Request bean is lost > > Classification: > > > > > > > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 1:04 PM > > > To: Struts Users Mailing List > > > Subject: RE: Request bean is lost > > > > > > > > > My lists are specific to each user based on security > > > attributes obtained > > > from the database. > > > Therefore, the application scope solution is not acceptable for these > > > lists. > > > > > > If I go the first solution route, then I have my 3 Lists as > > > part of the > > > Form bean. > > > The user selects from the list and submits the data. > > > If I set the imput to /Page.do wouldn't I lose the user's input? > > > > No, the input param in struts-config.xml is expressly used for the case > > where validation fails. So you > > won't lose anything. > > > > > > > > - Glenn > > > > > > > > > > > > > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > > > 06/07/2004 02:39 PM > > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > > cc: > > > > > > Subject:RE: Request bean is lost > > > Classification: > > > > > > > > > One solution is to point the input attribute value of the > > > PageSubmit.do > > > action mapping > > > to the Page.do action mapping thus re-retrieving the lists before > > > displaying the page. > > > > > > An alternative solution is to override the reset() of your > > > action form so > > > that it > > > retrieves the lists from the database and places them in the > > > appropriate > > > scope. > > > > > > If the lists are composed of static data, you might consider > > > retrieving > > > them on > > > application start up and placing them in application scope > > > (ServletContext) where > > > they will be available to all requests and then there would > > > be no need to > > > retrieve > > > them each tim
RE: Request bean is lost
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:32 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > Exactly. > > My Page.do has as a parameter the jsp page along with its Form Bean. > So it will get overwritten. > > Now what is the best clearest way to get this done? > Must I absolutely use a Session Bean to maintain the List and > the Form > Bean for the user inputted data? You could use a hidden var to indicate to your action to not fill in the values when it's set. > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > 06/07/2004 04:28 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:23 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > Umh... > > Let me try to express myself more clearly! > > > > Page.do > > - > > My Page.do obtains 3 lists from the DB based on the user's security > > attributes. > > Default values are set for 2 of the lists such as month and year. > > All of this is done in the Form Bean. > > > > > > PageSubmit.do > > --- > > The user selects a diffierent month other than the default > > and submits the > > request to PageSubmit.do > > > > The input for the PageSubmit.do mapping is /Page.do > > So this means that all of the Page.do logic is done again? > > Won't this overwrite what the user has entered? > > It shouldn't... unless you are overwriting those fields in page.do > explicitly. > Basically what's happening is right after the user hits > submit, struts > creates a form bean ( or uses an existing one), fills it from > the form, > then validates it. At that point, if there is a problem it > forwards to > the input param, without changing the form bean. In the case of the > action, it doesn't even know when or where the form bean was > created. It > just does it's thing quite merrily, then hands of to your code. > > > > > > > > > > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > > 06/07/2004 04:16 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > cc: > > > > Subject:RE: Request bean is lost > > Classification: > > > > > > > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 1:04 PM > > > To: Struts Users Mailing List > > > Subject: RE: Request bean is lost > > > > > > > > > My lists are specific to each user based on security > > > attributes obtained > > > from the database. > > > Therefore, the application scope solution is not acceptable > > for these > > > lists. > > > > > > If I go the first solution route, then I have my 3 Lists as > > > part of the > > > Form bean. > > > The user selects from the list and submits the data. > > > If I set the imput to /Page.do wouldn't I lose the user's input? > > > > No, the input param in struts-config.xml is expressly used > > for the case > > where validation fails. So you > > won't lose anything. > > > > > > > > - Glenn > > > > > > > > > > > > > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > > > 06/07/2004 02:39 PM > > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > > > > > > > To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > > > cc: > > > > > > Subject:RE: Request bean is lost > > > Classification: > > > > > > > > > One solution is to point the input attribute value of the > > > PageSubmit.do &
RE: Request bean is lost
Exactly. My Page.do has as a parameter the jsp page along with its Form Bean. So it will get overwritten. Now what is the best clearest way to get this done? Must I absolutely use a Session Bean to maintain the List and the Form Bean for the user inputted data? "Jim Barrows" <[EMAIL PROTECTED]> 06/07/2004 04:28 PM Please respond to "Struts Users Mailing List" To: "Struts Users Mailing List" <[EMAIL PROTECTED]> cc: Subject:RE: Request bean is lost Classification: > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:23 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > Umh... > Let me try to express myself more clearly! > > Page.do > - > My Page.do obtains 3 lists from the DB based on the user's security > attributes. > Default values are set for 2 of the lists such as month and year. > All of this is done in the Form Bean. > > > PageSubmit.do > --- > The user selects a diffierent month other than the default > and submits the > request to PageSubmit.do > > The input for the PageSubmit.do mapping is /Page.do > So this means that all of the Page.do logic is done again? > Won't this overwrite what the user has entered? It shouldn't... unless you are overwriting those fields in page.do explicitly. Basically what's happening is right after the user hits submit, struts creates a form bean ( or uses an existing one), fills it from the form, then validates it. At that point, if there is a problem it forwards to the input param, without changing the form bean. In the case of the action, it doesn't even know when or where the form bean was created. It just does it's thing quite merrily, then hands of to your code. > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > 06/07/2004 04:16 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject: RE: Request bean is lost > Classification: > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:04 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > My lists are specific to each user based on security > > attributes obtained > > from the database. > > Therefore, the application scope solution is not acceptable > for these > > lists. > > > > If I go the first solution route, then I have my 3 Lists as > > part of the > > Form bean. > > The user selects from the list and submits the data. > > If I set the imput to /Page.do wouldn't I lose the user's input? > > No, the input param in struts-config.xml is expressly used > for the case > where validation fails. So you > won't lose anything. > > > > > - Glenn > > > > > > > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > > 06/07/2004 02:39 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > cc: > > > > Subject:RE: Request bean is lost > > Classification: > > > > > > One solution is to point the input attribute value of the > > PageSubmit.do > > action mapping > > to the Page.do action mapping thus re-retrieving the lists before > > displaying the page. > > > > An alternative solution is to override the reset() of your > > action form so > > that it > > retrieves the lists from the database and places them in the > > appropriate > > scope. > > > > If the lists are composed of static data, you might consider > > retrieving > > them on > > application start up and placing them in application scope > > (ServletContext) where > > they will be available to all requests and then there would > > be no need to > > retrieve > > them each time the page is displayed. > > > > robert > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 1:39 PM > > > To: [EMAIL PROTECTED] > > > Subject: Requ
RE: Request bean is lost
Yes, it will write over any input values... In this case, you might want to consider populating the lists in the forms.reset() as mentioned earlier. ...not my prefered approach as it puts business logic in the form; its more of a work around. robert > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 4:23 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > Umh... > Let me try to express myself more clearly! > > Page.do > - > My Page.do obtains 3 lists from the DB based on the user's security > attributes. > Default values are set for 2 of the lists such as month and year. > All of this is done in the Form Bean. > > > PageSubmit.do > --- > The user selects a diffierent month other than the default and submits the > request to PageSubmit.do > > The input for the PageSubmit.do mapping is /Page.do > So this means that all of the Page.do logic is done again? > Won't this overwrite what the user has entered? > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > 06/07/2004 04:16 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:04 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > My lists are specific to each user based on security > > attributes obtained > > from the database. > > Therefore, the application scope solution is not acceptable for these > > lists. > > > > If I go the first solution route, then I have my 3 Lists as > > part of the > > Form bean. > > The user selects from the list and submits the data. > > If I set the imput to /Page.do wouldn't I lose the user's input? > > No, the input param in struts-config.xml is expressly used for the case > where validation fails. So you > won't lose anything. > > > > > - Glenn > > > > > > > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > > 06/07/2004 02:39 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > cc: > > > > Subject:RE: Request bean is lost > > Classification: > > > > > > One solution is to point the input attribute value of the > > PageSubmit.do > > action mapping > > to the Page.do action mapping thus re-retrieving the lists before > > displaying the page. > > > > An alternative solution is to override the reset() of your > > action form so > > that it > > retrieves the lists from the database and places them in the > > appropriate > > scope. > > > > If the lists are composed of static data, you might consider > > retrieving > > them on > > application start up and placing them in application scope > > (ServletContext) where > > they will be available to all requests and then there would > > be no need to > > retrieve > > them each time the page is displayed. > > > > robert > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 1:39 PM > > > To: [EMAIL PROTECTED] > > > Subject: Request bean is lost > > > > > > > > > Greetings, > > > > > > I have an action Page.do that gets 3 lists from a database. > > > It then places the lists inside a bean which is set in the request. > > > The Page.jsp iterates thru the bean to display the data. > > > > > > The form is posted to the PageSubmit.do. > > > But before the PageForm.validate() is executed. > > > Assume that an error is found... > > > The response is returned > > > > > > And this is where my bean is lost. > > > Why? > > > > > > I do not want to store thr bean in the HTTP Session. > > > > > > TIA, > > > Glenn. > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:23 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > Umh... > Let me try to express myself more clearly! > > Page.do > - > My Page.do obtains 3 lists from the DB based on the user's security > attributes. > Default values are set for 2 of the lists such as month and year. > All of this is done in the Form Bean. > > > PageSubmit.do > --- > The user selects a diffierent month other than the default > and submits the > request to PageSubmit.do > > The input for the PageSubmit.do mapping is /Page.do > So this means that all of the Page.do logic is done again? > Won't this overwrite what the user has entered? It shouldn't... unless you are overwriting those fields in page.do explicitly. Basically what's happening is right after the user hits submit, struts creates a form bean ( or uses an existing one), fills it from the form, then validates it. At that point, if there is a problem it forwards to the input param, without changing the form bean. In the case of the action, it doesn't even know when or where the form bean was created. It just does it's thing quite merrily, then hands of to your code. > > > > > > > "Jim Barrows" <[EMAIL PROTECTED]> > 06/07/2004 04:16 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:04 PM > > To: Struts Users Mailing List > > Subject: RE: Request bean is lost > > > > > > My lists are specific to each user based on security > > attributes obtained > > from the database. > > Therefore, the application scope solution is not acceptable > for these > > lists. > > > > If I go the first solution route, then I have my 3 Lists as > > part of the > > Form bean. > > The user selects from the list and submits the data. > > If I set the imput to /Page.do wouldn't I lose the user's input? > > No, the input param in struts-config.xml is expressly used > for the case > where validation fails. So you > won't lose anything. > > > > > - Glenn > > > > > > > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > > 06/07/2004 02:39 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > cc: > > > > Subject:RE: Request bean is lost > > Classification: > > > > > > One solution is to point the input attribute value of the > > PageSubmit.do > > action mapping > > to the Page.do action mapping thus re-retrieving the lists before > > displaying the page. > > > > An alternative solution is to override the reset() of your > > action form so > > that it > > retrieves the lists from the database and places them in the > > appropriate > > scope. > > > > If the lists are composed of static data, you might consider > > retrieving > > them on > > application start up and placing them in application scope > > (ServletContext) where > > they will be available to all requests and then there would > > be no need to > > retrieve > > them each time the page is displayed. > > > > robert > > > > > -Original Message- > > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > > Sent: Tuesday, July 06, 2004 1:39 PM > > > To: [EMAIL PROTECTED] > > > Subject: Request bean is lost > > > > > > > > > Greetings, > > > > > > I have an action Page.do that gets 3 lists from a database. > > > It then places the lists inside a bean which is set in > the request. > > > The Page.jsp iterates thru the bean to display the data. > > > > > > The form is posted to the PageSubmit.do. > > > But before the PageForm.validate() is executed. > > > Assume that an error is found... > > > The response is returned > > > > > > And this is where my bean is lost. > > > Why? > > > > > > I do not want to store thr bean in the HTTP Session. > > > > > > TIA, > > > Glenn. > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
Umh... Let me try to express myself more clearly! Page.do - My Page.do obtains 3 lists from the DB based on the user's security attributes. Default values are set for 2 of the lists such as month and year. All of this is done in the Form Bean. PageSubmit.do --- The user selects a diffierent month other than the default and submits the request to PageSubmit.do The input for the PageSubmit.do mapping is /Page.do So this means that all of the Page.do logic is done again? Won't this overwrite what the user has entered? "Jim Barrows" <[EMAIL PROTECTED]> 06/07/2004 04:16 PM Please respond to "Struts Users Mailing List" To: "Struts Users Mailing List" <[EMAIL PROTECTED]> cc: Subject:RE: Request bean is lost Classification: > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:04 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > My lists are specific to each user based on security > attributes obtained > from the database. > Therefore, the application scope solution is not acceptable for these > lists. > > If I go the first solution route, then I have my 3 Lists as > part of the > Form bean. > The user selects from the list and submits the data. > If I set the imput to /Page.do wouldn't I lose the user's input? No, the input param in struts-config.xml is expressly used for the case where validation fails. So you won't lose anything. > > - Glenn > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > 06/07/2004 02:39 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > One solution is to point the input attribute value of the > PageSubmit.do > action mapping > to the Page.do action mapping thus re-retrieving the lists before > displaying the page. > > An alternative solution is to override the reset() of your > action form so > that it > retrieves the lists from the database and places them in the > appropriate > scope. > > If the lists are composed of static data, you might consider > retrieving > them on > application start up and placing them in application scope > (ServletContext) where > they will be available to all requests and then there would > be no need to > retrieve > them each time the page is displayed. > > robert > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:39 PM > > To: [EMAIL PROTECTED] > > Subject: Request bean is lost > > > > > > Greetings, > > > > I have an action Page.do that gets 3 lists from a database. > > It then places the lists inside a bean which is set in the request. > > The Page.jsp iterates thru the bean to display the data. > > > > The form is posted to the PageSubmit.do. > > But before the PageForm.validate() is executed. > > Assume that an error is found... > > The response is returned > > > > And this is where my bean is lost. > > Why? > > > > I do not want to store thr bean in the HTTP Session. > > > > TIA, > > Glenn. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:04 PM > To: Struts Users Mailing List > Subject: RE: Request bean is lost > > > My lists are specific to each user based on security > attributes obtained > from the database. > Therefore, the application scope solution is not acceptable for these > lists. > > If I go the first solution route, then I have my 3 Lists as > part of the > Form bean. > The user selects from the list and submits the data. > If I set the imput to /Page.do wouldn't I lose the user's input? No, the input param in struts-config.xml is expressly used for the case where validation fails. So you won't lose anything. > > - Glenn > > > > > > "Robert Taylor" <[EMAIL PROTECTED]> > 06/07/2004 02:39 PM > Please respond to "Struts Users Mailing List" > > > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > > Subject:RE: Request bean is lost > Classification: > > > One solution is to point the input attribute value of the > PageSubmit.do > action mapping > to the Page.do action mapping thus re-retrieving the lists before > displaying the page. > > An alternative solution is to override the reset() of your > action form so > that it > retrieves the lists from the database and places them in the > appropriate > scope. > > If the lists are composed of static data, you might consider > retrieving > them on > application start up and placing them in application scope > (ServletContext) where > they will be available to all requests and then there would > be no need to > retrieve > them each time the page is displayed. > > robert > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 06, 2004 1:39 PM > > To: [EMAIL PROTECTED] > > Subject: Request bean is lost > > > > > > Greetings, > > > > I have an action Page.do that gets 3 lists from a database. > > It then places the lists inside a bean which is set in the request. > > The Page.jsp iterates thru the bean to display the data. > > > > The form is posted to the PageSubmit.do. > > But before the PageForm.validate() is executed. > > Assume that an error is found... > > The response is returned > > > > And this is where my bean is lost. > > Why? > > > > I do not want to store thr bean in the HTTP Session. > > > > TIA, > > Glenn. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
My lists are specific to each user based on security attributes obtained from the database. Therefore, the application scope solution is not acceptable for these lists. If I go the first solution route, then I have my 3 Lists as part of the Form bean. The user selects from the list and submits the data. If I set the imput to /Page.do wouldn't I lose the user's input? - Glenn "Robert Taylor" <[EMAIL PROTECTED]> 06/07/2004 02:39 PM Please respond to "Struts Users Mailing List" To: "Struts Users Mailing List" <[EMAIL PROTECTED]> cc: Subject:RE: Request bean is lost Classification: One solution is to point the input attribute value of the PageSubmit.do action mapping to the Page.do action mapping thus re-retrieving the lists before displaying the page. An alternative solution is to override the reset() of your action form so that it retrieves the lists from the database and places them in the appropriate scope. If the lists are composed of static data, you might consider retrieving them on application start up and placing them in application scope (ServletContext) where they will be available to all requests and then there would be no need to retrieve them each time the page is displayed. robert > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:39 PM > To: [EMAIL PROTECTED] > Subject: Request bean is lost > > > Greetings, > > I have an action Page.do that gets 3 lists from a database. > It then places the lists inside a bean which is set in the request. > The Page.jsp iterates thru the bean to display the data. > > The form is posted to the PageSubmit.do. > But before the PageForm.validate() is executed. > Assume that an error is found... > The response is returned > > And this is where my bean is lost. > Why? > > I do not want to store thr bean in the HTTP Session. > > TIA, > Glenn. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Request bean is lost
One solution is to point the input attribute value of the PageSubmit.do action mapping to the Page.do action mapping thus re-retrieving the lists before displaying the page. An alternative solution is to override the reset() of your action form so that it retrieves the lists from the database and places them in the appropriate scope. If the lists are composed of static data, you might consider retrieving them on application start up and placing them in application scope (ServletContext) where they will be available to all requests and then there would be no need to retrieve them each time the page is displayed. robert > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 06, 2004 1:39 PM > To: [EMAIL PROTECTED] > Subject: Request bean is lost > > > Greetings, > > I have an action Page.do that gets 3 lists from a database. > It then places the lists inside a bean which is set in the request. > The Page.jsp iterates thru the bean to display the data. > > The form is posted to the PageSubmit.do. > But before the PageForm.validate() is executed. > Assume that an error is found... > The response is returned > > And this is where my bean is lost. > Why? > > I do not want to store thr bean in the HTTP Session. > > TIA, > Glenn. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Request bean is lost
Try specifying input="/Page.do" instead of input="/Page.jsp" [EMAIL PROTECTED] wrote: Greetings, I have an action Page.do that gets 3 lists from a database. It then places the lists inside a bean which is set in the request. The Page.jsp iterates thru the bean to display the data. The form is posted to the PageSubmit.do. But before the PageForm.validate() is executed. Assume that an error is found... The response is returned And this is where my bean is lost. Why? I do not want to store thr bean in the HTTP Session. TIA, Glenn. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Request bean is lost
Greetings, I have an action Page.do that gets 3 lists from a database. It then places the lists inside a bean which is set in the request. The Page.jsp iterates thru the bean to display the data. The form is posted to the PageSubmit.do. But before the PageForm.validate() is executed. Assume that an error is found... The response is returned And this is where my bean is lost. Why? I do not want to store thr bean in the HTTP Session. TIA, Glenn.