Fwd: Re: Populating multiple forms from one action class
Sorry, this is for everyone too. _CJ -- Forwarded Message -- Subject: Re: Populating multiple forms from one action class Date: Wed, 4 Dec 2002 23:42:14 + From: Curtney Jacobs [EMAIL PROTECTED] To: Craig R. McClanahan [EMAIL PROTECTED] Greetings Craig!! just to verify. So, it is possible to populate multiple forms (contained on a single JSP page) from within one action class. For instance, I intend to have one action class that pre-populates three form beans: education, guardian, and enrollment. Currently, I have the action class pre-populating only one form bean and putting it into the current session, however, the data is not shown in the form when the jsp page is displayed. It only work when I associate the action to the form bean within my struts-config.xml Thanks in advance, Curtney Jacobs On Monday 02 December 2002 1:12 am, you wrote: On Fri, 29 Nov 2002, Curtney Jacobs wrote: Date: Fri, 29 Nov 2002 11:43:24 + From: Curtney Jacobs [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED], [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Populating multiple forms from one action class Greetings!! I understand what you are saying. However, I was thinking that it might be possible to pre-populate the ActionForms with a generic action class (not tied to any particular form) and put them in the current session. The following is an excerpt from Mastering Jakarta Struts that supports my idea. if the sesion already includes an instance of the ActionForm named by the form element's name attribute, then the values stored in its data members will be used to prepopulate the input values. Prepopulating input forms this way (by setting up the form bean in an Action that preceeds the display of the form) is a very standard approach in Struts based applications. It's a perfectly reasonable thing to do. Whether you do it with a generic Action, or a customized Action for each type of form is pretty much up to you. If anyone else have any opinions on this please don't be afraid to comment :-) Thanks in advance, Curtney Jacobs Craig -- U-Interface.com --- -- U-Interface.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Fwd: Re: Populating multiple forms from one action class
Greetings!! I have solved the problem, quite simple really. I was not associating the ActionForm instance to the form bean declared in my struts-config.xml file. However, I would like a cleaner approach to doing the association. Currently, I have the following in my generic action class: request.getSession().setAttribute(StudentForm, sForm); request.getSession().setAttribute(GuardianForm, gForm); Thanks in advance, Curtney Jacobs On Thursday 05 December 2002 12:11 am, Curtney Jacobs wrote: Sorry, this is for everyone too. _CJ -- Forwarded Message -- Subject: Re: Populating multiple forms from one action class Date: Wed, 4 Dec 2002 23:42:14 + From: Curtney Jacobs [EMAIL PROTECTED] To: Craig R. McClanahan [EMAIL PROTECTED] Greetings Craig!! just to verify. So, it is possible to populate multiple forms (contained on a single JSP page) from within one action class. For instance, I intend to have one action class that pre-populates three form beans: education, guardian, and enrollment. Currently, I have the action class pre-populating only one form bean and putting it into the current session, however, the data is not shown in the form when the jsp page is displayed. It only work when I associate the action to the form bean within my struts-config.xml Thanks in advance, Curtney Jacobs On Monday 02 December 2002 1:12 am, you wrote: On Fri, 29 Nov 2002, Curtney Jacobs wrote: Date: Fri, 29 Nov 2002 11:43:24 + From: Curtney Jacobs [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED], [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Populating multiple forms from one action class Greetings!! I understand what you are saying. However, I was thinking that it might be possible to pre-populate the ActionForms with a generic action class (not tied to any particular form) and put them in the current session. The following is an excerpt from Mastering Jakarta Struts that supports my idea. if the sesion already includes an instance of the ActionForm named by the form element's name attribute, then the values stored in its data members will be used to prepopulate the input values. Prepopulating input forms this way (by setting up the form bean in an Action that preceeds the display of the form) is a very standard approach in Struts based applications. It's a perfectly reasonable thing to do. Whether you do it with a generic Action, or a customized Action for each type of form is pretty much up to you. If anyone else have any opinions on this please don't be afraid to comment :-) Thanks in advance, Curtney Jacobs Craig -- U-Interface.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Populating multiple forms from one action class
On Fri, 29 Nov 2002, Curtney Jacobs wrote: Date: Fri, 29 Nov 2002 11:43:24 + From: Curtney Jacobs [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED], [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Populating multiple forms from one action class Greetings!! I understand what you are saying. However, I was thinking that it might be possible to pre-populate the ActionForms with a generic action class (not tied to any particular form) and put them in the current session. The following is an excerpt from Mastering Jakarta Struts that supports my idea. if the sesion already includes an instance of the ActionForm named by the form element's name attribute, then the values stored in its data members will be used to prepopulate the input values. Prepopulating input forms this way (by setting up the form bean in an Action that preceeds the display of the form) is a very standard approach in Struts based applications. It's a perfectly reasonable thing to do. Whether you do it with a generic Action, or a customized Action for each type of form is pretty much up to you. If anyone else have any opinions on this please don't be afraid to comment :-) Thanks in advance, Curtney Jacobs Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Populating multiple forms from one action class
Hi Curtney, The forms could only be populated if the form data is send via the HTTP request. that only happens if the there is only one enclosing HTML form. Since (as far as I know) the html:form Tag is bound to exact one HTML form, I don't think that this is possible. You could possibly inherit one overall form from all the simple forms but you will run into problems with validation (hence only one validate method for the form) and the form name (the form extending all the other forms will be saved under a single overall name) and even properbly form bean property names if they interfere, so this does not seam a good approach to me. But you could try, or more straight forward use only one form for related fields that should be all populated together. Hope that helps, Sven [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Curtney Jacobs [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 28. November 2002 17:15 To: [EMAIL PROTECTED] Subject: Populating multiple forms from one action class Greetings! is it possible to populate multiple forms on the same jsp page from only one action class? I have three forms (more may be added later on) on one jsp page. Each form is associated with its own action class for updating (submit) data. However, when I select an employee I would like to populate all three forms simutaneously. Thanks in advance, Curtney Jacobs -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Populating multiple forms from one action class
Greetings!! I understand what you are saying. However, I was thinking that it might be possible to pre-populate the ActionForms with a generic action class (not tied to any particular form) and put them in the current session. The following is an excerpt from Mastering Jakarta Struts that supports my idea. if the sesion already includes an instance of the ActionForm named by the form element's name attribute, then the values stored in its data members will be used to prepopulate the input values. If anyone else have any opinions on this please don't be afraid to comment :-) Thanks in advance, Curtney Jacobs On Friday 29 November 2002 12:24 pm, Sven Frederik Pohl wrote: Hi Curtney, The forms could only be populated if the form data is send via the HTTP request. that only happens if the there is only one enclosing HTML form. Since (as far as I know) the html:form Tag is bound to exact one HTML form, I don't think that this is possible. You could possibly inherit one overall form from all the simple forms but you will run into problems with validation (hence only one validate method for the form) and the form name (the form extending all the other forms will be saved under a single overall name) and even properbly form bean property names if they interfere, so this does not seam a good approach to me. But you could try, or more straight forward use only one form for related fields that should be all populated together. Hope that helps, Sven [EMAIL PROTECTED] [EMAIL PROTECTED] -Original Message- From: Curtney Jacobs [mailto:[EMAIL PROTECTED]] Sent: Donnerstag, 28. November 2002 17:15 To: [EMAIL PROTECTED] Subject: Populating multiple forms from one action class Greetings! is it possible to populate multiple forms on the same jsp page from only one action class? I have three forms (more may be added later on) on one jsp page. Each form is associated with its own action class for updating (submit) data. However, when I select an employee I would like to populate all three forms simutaneously. Thanks in advance, Curtney Jacobs -- U-Interface.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]