Re: Forwarding Actions onto other Actions
There is actually just such a check, though this would be a very good suggestion if there weren't ;-) See processActionForm in ActionServlet. Please let us know if you see anything else. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Bob Rullo wrote: This is my first posting to the dev board so bare with me. From what I've seen in looking in the ActionServlet code it appears that everytime a action is called the form instance for that action is placed into the mapping.getScope( ). Shouldn't there be a check before to see if the ActionForm is already in the scope? Reason being that one action could make some modifications to a form instance and then forward it to another action that will make more changes to the form instance. Basically my problem is that if two actions having the same form instance are called in the same request the form instance stored in the request will always be overridden by the last action. I propose that we should do a check before each action to determine if the form already exists in the desired scope. If so, use the scoped instance, if not, build the form instance off of the request parameters as it is now. If this was by design, could someone shed some light to why? Thank you for your help, -Bob
Re: Forwarding Actions onto other Actions
Ted, I did see that check in the processActionForm method, but if you notice, in the processPopulate which is called right after the processActionForm call you'll see that the bean, no matter where it came from, gets reset and then populated with the request parameters via the RequestUtil.populate method. Am I missing something here? Sure seems like it'll reset the form bean no matter what which to me, isn't desirable. -Bob - Original Message - From: Ted Husted archive@jab.org To: [EMAIL PROTECTED] Sent: Sunday, September 16, 2001 6:04 AM Subject: Re: Forwarding Actions onto other Actions There is actually just such a check, though this would be a very good suggestion if there weren't ;-) See processActionForm in ActionServlet. Please let us know if you see anything else. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Bob Rullo wrote: This is my first posting to the dev board so bare with me. From what I've seen in looking in the ActionServlet code it appears that everytime a action is called the form instance for that action is placed into the mapping.getScope( ). Shouldn't there be a check before to see if the ActionForm is already in the scope? Reason being that one action could make some modifications to a form instance and then forward it to another action that will make more changes to the form instance. Basically my problem is that if two actions having the same form instance are called in the same request the form instance stored in the request will always be overridden by the last action. I propose that we should do a check before each action to determine if the form already exists in the desired scope. If so, use the scoped instance, if not, build the form instance off of the request parameters as it is now. If this was by design, could someone shed some light to why? Thank you for your help, -Bob
Re: Forwarding Actions onto other Actions
Unfortunately, calling reset is necessary. A primary reason is that that if a checkbox is unchecked then it will be ommitted from the request. This can give inconsistent results when a ActionForm is being returned for editing. The reset method gives the developer the opportunity to set the checkbox to a known state (to make up for the vagrancies of HTML). The abstract implementation of reset is empty. If a developer is going to reuse beans between requests, it is the developer's responsiblity to see that reset performs correctly. All the population also takes places through mutators that the developer defines. If there are circumstances where a ActionForm should not populate itself through the request, the developer can design the mutators accordingly. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Bob Rullo wrote: Ted, I did see that check in the processActionForm method, but if you notice, in the processPopulate which is called right after the processActionForm call you'll see that the bean, no matter where it came from, gets reset and then populated with the request parameters via the RequestUtil.populate method. Am I missing something here? Sure seems like it'll reset the form bean no matter what which to me, isn't desirable. -Bob - Original Message - From: Ted Husted archive@jab.org To: [EMAIL PROTECTED] Sent: Sunday, September 16, 2001 6:04 AM Subject: Re: Forwarding Actions onto other Actions There is actually just such a check, though this would be a very good suggestion if there weren't ;-) See processActionForm in ActionServlet. Please let us know if you see anything else. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Bob Rullo wrote: This is my first posting to the dev board so bare with me. From what I've seen in looking in the ActionServlet code it appears that everytime a action is called the form instance for that action is placed into the mapping.getScope( ). Shouldn't there be a check before to see if the ActionForm is already in the scope? Reason being that one action could make some modifications to a form instance and then forward it to another action that will make more changes to the form instance. Basically my problem is that if two actions having the same form instance are called in the same request the form instance stored in the request will always be overridden by the last action. I propose that we should do a check before each action to determine if the form already exists in the desired scope. If so, use the scoped instance, if not, build the form instance off of the request parameters as it is now. If this was by design, could someone shed some light to why? Thank you for your help, -Bob
RE: Forwarding Actions onto other Actions
Hi, I think Bob's point is that if an action form has been populated once during a request, it would be useful if the reset wasn't called again. i.e. if the request was forwarded to other actions which use an action form of the same name, it'd be useful if form properties could be set during the first action and not reset before arriving at the second action. I've coded around this by setting request attributes in the first action and reading them in the second (ugly). I don't think anyone disagrees that it's essential the action forms are reset between requests. Cheers Nathan -Original Message- From: Ted Husted [mailto:archive@jab.org] Sent: Sunday, September 16, 2001 1:14 PM To: [EMAIL PROTECTED] Subject: Re: Forwarding Actions onto other Actions Unfortunately, calling reset is necessary. A primary reason is that that if a checkbox is unchecked then it will be ommitted from the request. This can give inconsistent results when a ActionForm is being returned for editing. The reset method gives the developer the opportunity to set the checkbox to a known state (to make up for the vagrancies of HTML). The abstract implementation of reset is empty. If a developer is going to reuse beans between requests, it is the developer's responsiblity to see that reset performs correctly. All the population also takes places through mutators that the developer defines. If there are circumstances where a ActionForm should not populate itself through the request, the developer can design the mutators accordingly. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Bob Rullo wrote: Ted, I did see that check in the processActionForm method, but if you notice, in the processPopulate which is called right after the processActionForm call you'll see that the bean, no matter where it came from, gets reset and then populated with the request parameters via the RequestUtil.populate method. Am I missing something here? Sure seems like it'll reset the form bean no matter what which to me, isn't desirable. -Bob - Original Message - From: Ted Husted archive@jab.org To: [EMAIL PROTECTED] Sent: Sunday, September 16, 2001 6:04 AM Subject: Re: Forwarding Actions onto other Actions There is actually just such a check, though this would be a very good suggestion if there weren't ;-) See processActionForm in ActionServlet. Please let us know if you see anything else. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Bob Rullo wrote: This is my first posting to the dev board so bare with me. From what I've seen in looking in the ActionServlet code it appears that everytime a action is called the form instance for that action is placed into the mapping.getScope( ). Shouldn't there be a check before to see if the ActionForm is already in the scope? Reason being that one action could make some modifications to a form instance and then forward it to another action that will make more changes to the form instance. Basically my problem is that if two actions having the same form instance are called in the same request the form instance stored in the request will always be overridden by the last action. I propose that we should do a check before each action to determine if the form already exists in the desired scope. If so, use the scoped instance, if not, build the form instance off of the request parameters as it is now. If this was by design, could someone shed some light to why? Thank you for your help, -Bob ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper at LevelSeas for the presence of computer viruses. www.mimesweeper.com **
Forwarding Actions onto other Actions
This is my first posting to the dev board so bare with me. From what I've seen in looking in the ActionServlet code it appears that everytime a action is called the form instance for that action is placed into the mapping.getScope( ). Shouldn't there be a check before to see if the ActionForm is already in the scope? Reason being that one action could make some modifications to a form instance and then forward it to another action that will make more changes to the form instance. Basically my problem is that if two actions having the same form instance are called in the same request the form instance stored in the request will always be overridden by the last action. I propose that we should do a check before each action to determine if the form already exists in the desired scope. If so, use the scoped instance, if not, build the form instance off of the request parameters as it is now. If this was by design, could someone shed some light to why? Thank you for your help, -Bob