Re: Populating form Elements from another object.
Hi Niall, I figured out the problem. The problem was that, my DynaClass returned the class name for the getName() method call , whereas the DynaActionFormClass returns the name through getName() method of FormBeanConfig. This is the key that is used to store and retrieve the bean instance. As a result, in the createActionForm of RequestUtils, the if check(in bold ) will fail and the stored instance will not be returned. if (config.getDynamic()) { String className = ((DynaBean) instance).getDynaClass().getName(); * if (className.equals(config.getName())) {* if (log.isDebugEnabled()) { log.debug( " Recycling existing DynaActionForm instance " + "of type '" + className + "'"); log.trace(" --> " + instance); } return (instance); } As my class is an extension of DynaActionForm, the following if check will be satisfied, and a new instance will be returned each and every time. if (config.getDynamic()) { try { *DynaActionFormClass dynaClass = DynaActionFormClass.createDynaActionFormClass(config); instance = (ActionForm) dynaClass.newInstance();* ((DynaActionForm) instance).initialize(mapping); if (log.isDebugEnabled()) { log.debug( " Creating new DynaActionForm instance " + "of type '" + config.getType() + "'"); log.trace(" --> " + instance); } } I have rectified it by writing a separate implementation instead of extending the DynaActionForm, so that the else part of the first code snippet will be executed. Now everything is working fine. Thanks for your contribution without which i would be duplicating the informations in the jsp page and the xml file. Your idea has reduced a lot of coding. Thanks once again Thanks Shanmugam PL Niall Pemberton wrote: Shanmugam, I think your problem lies in the way you have defined your two actions in the struts-config.xml - one of them has scope="session" and the other doesn't, which means it will probably default to request. I think this is causing your problem because Struts only looks for the ActionForm in the scope of the mapping specified - so in your case I believe its creating two versions of "severityForm". Try addding a scope="session" to your "/severityDetails" action and see if that sorts it out. Niall - Original Message - From: shanmugampl To: Struts Users Mailing List Sent: Friday, March 12, 2004 3:55 AM Subject: Re: Populating form Elements from another object. Hi Niall, Thanks for your inputs. I followed your methodology with slight changes. I have a class MCDynaClass which equals your LazyDynaClass. Instead of having a separate bean as LazyDynaBean, i extended the DynaActionForm as MCDynaActionForm and overridden the set methods as per my requirement. The entry in the struts-config.xml will be like In the ActionClass i will get the DataObject(my own object) and set it to the form through the setDataObject method. MCDynaActionForm userForm = (MCDynaActionForm) form; userForm.setDataObject(newDO); By this way i am able to populate the values dynamically. The problems comes when i am submitting the form. When the form is submitted, the instance of the form that i am getting in the action class is different. As a result, I cannot update the dataObject as it is null. I could not figure out where i have gone wrong. I have attached my source. Kindly help me. Thanks Shanmugam PL Niall Pemberton wrote: Yup, thats it - plus dynamic="true" Oh, I noticed an error in LazyValidatorForm, its declared as "abstract" - which it shouldn't be - I don't use it directly, I use LazyValidatorActionForm which extends it. Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 8:53 AM Subject: Re: Populating form Elements from another object. I haven't seen the code but if what i understand of what Niall has been saying you'd use them instead of DynaActionForm. of course you'll need to call the package and class name to something appropriate. On 9 Mar 2004, at 09:47, shanmugampl wrote: Hi, I saw your code. I have one doubt. How do you plugin your own DynaBean implementation into the struts framework.
Re: Populating form Elements from another object.
Shanmugam, I think your problem lies in the way you have defined your two actions in the struts-config.xml - one of them has scope="session" and the other doesn't, which means it will probably default to request. I think this is causing your problem because Struts only looks for the ActionForm in the scope of the mapping specified - so in your case I believe its creating two versions of "severityForm". Try addding a scope="session" to your "/severityDetails" action and see if that sorts it out. Niall - Original Message - From: shanmugampl To: Struts Users Mailing List Sent: Friday, March 12, 2004 3:55 AM Subject: Re: Populating form Elements from another object. Hi Niall, Thanks for your inputs. I followed your methodology with slight changes. I have a class MCDynaClass which equals your LazyDynaClass. Instead of having a separate bean as LazyDynaBean, i extended the DynaActionForm as MCDynaActionForm and overridden the set methods as per my requirement. The entry in the struts-config.xml will be like In the ActionClass i will get the DataObject(my own object) and set it to the form through the setDataObject method. MCDynaActionForm userForm = (MCDynaActionForm) form; userForm.setDataObject(newDO); By this way i am able to populate the values dynamically. The problems comes when i am submitting the form. When the form is submitted, the instance of the form that i am getting in the action class is different. As a result, I cannot update the dataObject as it is null. I could not figure out where i have gone wrong. I have attached my source. Kindly help me. Thanks Shanmugam PL Niall Pemberton wrote: Yup, thats it - plus dynamic="true" Oh, I noticed an error in LazyValidatorForm, its declared as "abstract" - which it shouldn't be - I don't use it directly, I use LazyValidatorActionForm which extends it. Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 8:53 AM Subject: Re: Populating form Elements from another object. I haven't seen the code but if what i understand of what Niall has been saying you'd use them instead of DynaActionForm. of course you'll need to call the package and class name to something appropriate. On 9 Mar 2004, at 09:47, shanmugampl wrote: Hi, I saw your code. I have one doubt. How do you plugin your own DynaBean implementation into the struts framework. Shanmugam PL Niall Pemberton wrote: I wrote these http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "shanmugampl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 25, 2004 7:00 AM Subject: Populating form Elements from another object. Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- package com.adventnet.client.struts.action; import org.apache.struts.action.DynaActionForm; import java.lang.reflect.Array; import java.util.*; import com.adventnet.persistence.ejb.*; import com.adventnet.persistence.*; import com.adventnet.nms.ms.config.client.ConfigurationCache; import org.apache.commons.beanutils.*; public class MCDynaActionForm extends DynaActionForm { protected MCDynaClass wccDynaClass = null;
Re: Populating form Elements from another object.
Hi Niall, Thanks for your inputs. I followed your methodology with slight changes. I have a class MCDynaClass which equals your LazyDynaClass. Instead of having a separate bean as LazyDynaBean, i extended the DynaActionForm as MCDynaActionForm and overridden the set methods as per my requirement. The entry in the struts-config.xml will be like In the ActionClass i will get the DataObject(my own object) and set it to the form through the setDataObject method. MCDynaActionForm userForm = (MCDynaActionForm) form; userForm.setDataObject(newDO); By this way i am able to populate the values dynamically. The problems comes when i am submitting the form. When the form is submitted, the instance of the form that i am getting in the action class is different. As a result, I cannot update the dataObject as it is null. I could not figure out where i have gone wrong. I have attached my source. Kindly help me. Thanks Shanmugam PL Niall Pemberton wrote: Yup, thats it - plus dynamic="true" Oh, I noticed an error in LazyValidatorForm, its declared as "abstract" - which it shouldn't be - I don't use it directly, I use LazyValidatorActionForm which extends it. Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 8:53 AM Subject: Re: Populating form Elements from another object. I haven't seen the code but if what i understand of what Niall has been saying you'd use them instead of DynaActionForm. of course you'll need to call the package and class name to something appropriate. On 9 Mar 2004, at 09:47, shanmugampl wrote: Hi, I saw your code. I have one doubt. How do you plugin your own DynaBean implementation into the struts framework. Shanmugam PL Niall Pemberton wrote: I wrote these http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "shanmugampl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 25, 2004 7:00 AM Subject: Populating form Elements from another object. Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] package com.adventnet.client.struts.action; import org.apache.struts.action.DynaActionForm; import java.lang.reflect.Array; import java.util.*; import com.adventnet.persistence.ejb.*; import com.adventnet.persistence.*; import com.adventnet.nms.ms.config.client.ConfigurationCache; import org.apache.commons.beanutils.*; public class MCDynaActionForm extends DynaActionForm { protected MCDynaClass wccDynaClass = null; public MCDynaActionForm(){ wccDynaClass = new MCDynaClass(); } public DynaClass getDynaClass() { return (this.wccDynaClass); } public void set(String name, Object value) { System.out.println("*** SHAN : Set method called. Updation takes place in data object also ** " + dataObject); System.out.println("*** SHAN : HashValue is ** " + hashCode()); ((MCDynaClass)getDynaClass()).add(name, value.getClass()); dynaValues.put(name, value); if(dataObject != null){
Re: Populating form Elements from another object.
I guess you could use this badly and create such a hole - but the problem wouldn't be with LazyDynaBean, but with how you are using it. If you have an action that doesn't validate whats in the ActionForm and takes whatever is in there and updates your model then you've got a problem. If I had an "update customer name" action, then my action will only take the customer name from the ActionForm and update the model - if some smart hack has also populated a "creditLimit" property - so what, I don't do anything with it in my action, so there is no harm done. An alternative to my LazyDynaBeans is the "formDef" stuff that Hubert Rabago has done - this takes a different approach to the same kind of issues I was trying to address with my Lazy stuff. He basically has combined and extended form definitions from struts-config.xml and validation.xml and probably wouldn't have the same kind of issue you are raising: FormDef pages and downloads: http://www.rabago.net/struts/formdef An introduction manual is also available at http://www.rabago.net/struts/formdef/manual.htm Niall - Original Message - From: "Erez Efrati" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Wednesday, March 10, 2004 3:25 PM Subject: RE: Populating form Elements from another object. It looks cool, still there´s a problem of being open to small nasty attacks. Since the set() method adds fields dynamically, it would do it also upon properties population. So, when a request comes loaded with fields that never should have been sent, the lazyDynaBean would add them, thus creating a small hole of security. What do you think? Erez -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 5:20 PM To: Struts Users Mailing List Subject: Re: Populating form Elements from another object. Thats it exactly. I have updated my web page with examples for LazyBean and LazyValidatorActionForm processing: http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, March 10, 2004 8:16 AM Subject: Re: Populating form Elements from another object. > Again I haven't used Niall's classes but I'd hazard a guess that as > they extend DynaBean that you use the map like interface for accessing > these properties. In fact I imagine you can cast them as a DynaBean > like you can with the DynaActionForms > > DynaBean myForm = (DynaBean) form; > String foo = myForm.get("foo").toString(); > > > > On 9 Mar 2004, at 20:27, Metin Carl wrote: > > > This is really good. An example of processing this form in Action > > classes > > would be very useful too as the way Shanmugam needs. > > > > > > "Niall Pemberton" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Yup, thats it - plus dynamic="true" > >> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> > >> Oh, I noticed an error in LazyValidatorForm, its declared as > >> "abstract" - > >> which it shouldn't be - I don't use it directly, I use > >> LazyValidatorActionForm which extends it. > >> > >> Niall > >> > >> > >> - Original Message - > >> From: "Mark Lowe" <[EMAIL PROTECTED]> > >> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >> Sent: Tuesday, March 09, 2004 8:53 AM > >> Subject: Re: Populating form Elements from another object. > >> > >> > >>> I haven't seen the code but if what i understand of what Niall has > >>> been > >>> saying you'd use them instead of DynaActionForm. > >>> > >>> >>> /> > >>> > >>> of course you'll need to call the package and class name to something > >>> appropriate. > >>> > >>> On 9 Mar 2004, at 09:47, shanmugampl wrote: > >>> > >>>> Hi, > >>>> > >>>>I saw your code. I have one doubt. How do you plugin your own > >>>> DynaBean implement
RE: Populating form Elements from another object.
It looks cool, still there´s a problem of being open to small nasty attacks. Since the set() method adds fields dynamically, it would do it also upon properties population. So, when a request comes loaded with fields that never should have been sent, the lazyDynaBean would add them, thus creating a small hole of security. What do you think? Erez -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 5:20 PM To: Struts Users Mailing List Subject: Re: Populating form Elements from another object. Thats it exactly. I have updated my web page with examples for LazyBean and LazyValidatorActionForm processing: http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, March 10, 2004 8:16 AM Subject: Re: Populating form Elements from another object. > Again I haven't used Niall's classes but I'd hazard a guess that as > they extend DynaBean that you use the map like interface for accessing > these properties. In fact I imagine you can cast them as a DynaBean > like you can with the DynaActionForms > > DynaBean myForm = (DynaBean) form; > String foo = myForm.get("foo").toString(); > > > > On 9 Mar 2004, at 20:27, Metin Carl wrote: > > > This is really good. An example of processing this form in Action > > classes > > would be very useful too as the way Shanmugam needs. > > > > > > "Niall Pemberton" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Yup, thats it - plus dynamic="true" > >> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> > >> Oh, I noticed an error in LazyValidatorForm, its declared as > >> "abstract" - > >> which it shouldn't be - I don't use it directly, I use > >> LazyValidatorActionForm which extends it. > >> > >> Niall > >> > >> > >> - Original Message - > >> From: "Mark Lowe" <[EMAIL PROTECTED]> > >> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >> Sent: Tuesday, March 09, 2004 8:53 AM > >> Subject: Re: Populating form Elements from another object. > >> > >> > >>> I haven't seen the code but if what i understand of what Niall has > >>> been > >>> saying you'd use them instead of DynaActionForm. > >>> > >>> >>> /> > >>> > >>> of course you'll need to call the package and class name to something > >>> appropriate. > >>> > >>> On 9 Mar 2004, at 09:47, shanmugampl wrote: > >>> > >>>> Hi, > >>>> > >>>>I saw your code. I have one doubt. How do you plugin your own > >>>> DynaBean implementation into the struts framework. > >>>> > >>>> Shanmugam PL > >>>> > >>>> Niall Pemberton wrote: > >>>> > >>>>> I wrote these > >>>>> > >>>>> http://www.niallp.pwp.blueyonder.co.uk > >>>>> > >>>>> Niall > >>>>> > >>>>> - Original Message - From: "shanmugampl" > >>>>> <[EMAIL PROTECTED]> > >>>>> To: <[EMAIL PROTECTED]> > >>>>> Sent: Wednesday, February 25, 2004 7:00 AM > >>>>> Subject: Populating form Elements from another object. > >>>>> > >>>>> > >>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I have a requirement where i need to populate the values of a > >>>>>> form from another object, and then again transform the contents of > >>>>>> the form back to the object once the form is submitted. i.e Say, > >>>>>> when i click a button, i do some functionalities and have a > >>>>>> Properties object as an output. The keys in the Properties object > >>>>>> are not static. These
Re: Populating form Elements from another object.
Thats it exactly. I have updated my web page with examples for LazyBean and LazyValidatorActionForm processing: http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, March 10, 2004 8:16 AM Subject: Re: Populating form Elements from another object. > Again I haven't used Niall's classes but I'd hazard a guess that as > they extend DynaBean that you use the map like interface for accessing > these properties. In fact I imagine you can cast them as a DynaBean > like you can with the DynaActionForms > > DynaBean myForm = (DynaBean) form; > String foo = myForm.get("foo").toString(); > > > > On 9 Mar 2004, at 20:27, Metin Carl wrote: > > > This is really good. An example of processing this form in Action > > classes > > would be very useful too as the way Shanmugam needs. > > > > > > "Niall Pemberton" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Yup, thats it - plus dynamic="true" > >> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> >> type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > >> > >> Oh, I noticed an error in LazyValidatorForm, its declared as > >> "abstract" - > >> which it shouldn't be - I don't use it directly, I use > >> LazyValidatorActionForm which extends it. > >> > >> Niall > >> > >> > >> - Original Message - > >> From: "Mark Lowe" <[EMAIL PROTECTED]> > >> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >> Sent: Tuesday, March 09, 2004 8:53 AM > >> Subject: Re: Populating form Elements from another object. > >> > >> > >>> I haven't seen the code but if what i understand of what Niall has > >>> been > >>> saying you'd use them instead of DynaActionForm. > >>> > >>> >>> /> > >>> > >>> of course you'll need to call the package and class name to something > >>> appropriate. > >>> > >>> On 9 Mar 2004, at 09:47, shanmugampl wrote: > >>> > >>>> Hi, > >>>> > >>>>I saw your code. I have one doubt. How do you plugin your own > >>>> DynaBean implementation into the struts framework. > >>>> > >>>> Shanmugam PL > >>>> > >>>> Niall Pemberton wrote: > >>>> > >>>>> I wrote these > >>>>> > >>>>> http://www.niallp.pwp.blueyonder.co.uk > >>>>> > >>>>> Niall > >>>>> > >>>>> - Original Message - From: "shanmugampl" > >>>>> <[EMAIL PROTECTED]> > >>>>> To: <[EMAIL PROTECTED]> > >>>>> Sent: Wednesday, February 25, 2004 7:00 AM > >>>>> Subject: Populating form Elements from another object. > >>>>> > >>>>> > >>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I have a requirement where i need to populate the values of a > >>>>>> form from another object, and then again transform the contents of > >>>>>> the form back to the object once the form is submitted. i.e Say, > >>>>>> when i click a button, i do some functionalities and have a > >>>>>> Properties object as an output. The keys in the Properties object > >>>>>> are not static. These values need to be shown in a form. As the > >>>>>> keys > >>>>>> retrieved for the current operation is not known, i cant define > >>>>>> the > >>>>>> values in the struts-config.xml for the dynaactionclass. > >>>>>> > >>>>>> Is it possible to extend the dynaactionclass, and during its > >>>>>> init or something, iterate the properties object and populate the > >>>>>> form. Are there any other way of doing it. > >>>>>> > >>>>>> Thanks > >>>>>> Shanmugam PL > >>>>>> > >>>>>> > >>> > >>>> > >>>> - > >>>>>> 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] > >>> > >>> > > > > > > > > > > - > > 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: Populating form Elements from another object.
Again I haven't used Niall's classes but I'd hazard a guess that as they extend DynaBean that you use the map like interface for accessing these properties. In fact I imagine you can cast them as a DynaBean like you can with the DynaActionForms DynaBean myForm = (DynaBean) form; String foo = myForm.get("foo").toString(); On 9 Mar 2004, at 20:27, Metin Carl wrote: This is really good. An example of processing this form in Action classes would be very useful too as the way Shanmugam needs. "Niall Pemberton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Yup, thats it - plus dynamic="true" Oh, I noticed an error in LazyValidatorForm, its declared as "abstract" - which it shouldn't be - I don't use it directly, I use LazyValidatorActionForm which extends it. Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 8:53 AM Subject: Re: Populating form Elements from another object. I haven't seen the code but if what i understand of what Niall has been saying you'd use them instead of DynaActionForm. of course you'll need to call the package and class name to something appropriate. On 9 Mar 2004, at 09:47, shanmugampl wrote: Hi, I saw your code. I have one doubt. How do you plugin your own DynaBean implementation into the struts framework. Shanmugam PL Niall Pemberton wrote: I wrote these http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "shanmugampl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 25, 2004 7:00 AM Subject: Populating form Elements from another object. Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - 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] - 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: Populating form Elements from another object.
This is really good. An example of processing this form in Action classes would be very useful too as the way Shanmugam needs. "Niall Pemberton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Yup, thats it - plus dynamic="true" > > type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > type="lib.framework.struts.LazyValidatorActionForm" dynamic="true" /> > > Oh, I noticed an error in LazyValidatorForm, its declared as "abstract" - > which it shouldn't be - I don't use it directly, I use > LazyValidatorActionForm which extends it. > > Niall > > > - Original Message ----- > From: "Mark Lowe" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Tuesday, March 09, 2004 8:53 AM > Subject: Re: Populating form Elements from another object. > > > > I haven't seen the code but if what i understand of what Niall has been > > saying you'd use them instead of DynaActionForm. > > > > > > > > of course you'll need to call the package and class name to something > > appropriate. > > > > On 9 Mar 2004, at 09:47, shanmugampl wrote: > > > > > Hi, > > > > > >I saw your code. I have one doubt. How do you plugin your own > > > DynaBean implementation into the struts framework. > > > > > > Shanmugam PL > > > > > > Niall Pemberton wrote: > > > > > >> I wrote these > > >> > > >> http://www.niallp.pwp.blueyonder.co.uk > > >> > > >> Niall > > >> > > >> - Original Message - From: "shanmugampl" > > >> <[EMAIL PROTECTED]> > > >> To: <[EMAIL PROTECTED]> > > >> Sent: Wednesday, February 25, 2004 7:00 AM > > >> Subject: Populating form Elements from another object. > > >> > > >> > > >> > > >>> Hi, > > >>> > > >>> I have a requirement where i need to populate the values of a > > >>> form from another object, and then again transform the contents of > > >>> the form back to the object once the form is submitted. i.e Say, > > >>> when i click a button, i do some functionalities and have a > > >>> Properties object as an output. The keys in the Properties object > > >>> are not static. These values need to be shown in a form. As the keys > > >>> retrieved for the current operation is not known, i cant define the > > >>> values in the struts-config.xml for the dynaactionclass. > > >>> > > >>> Is it possible to extend the dynaactionclass, and during its > > >>> init or something, iterate the properties object and populate the > > >>> form. Are there any other way of doing it. > > >>> > > >>> Thanks > > >>> Shanmugam PL > > >>> > > >>> > > >>> - > > >>> 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] > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Populating form Elements from another object.
Yup, thats it - plus dynamic="true" Oh, I noticed an error in LazyValidatorForm, its declared as "abstract" - which it shouldn't be - I don't use it directly, I use LazyValidatorActionForm which extends it. Niall - Original Message - From: "Mark Lowe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, March 09, 2004 8:53 AM Subject: Re: Populating form Elements from another object. > I haven't seen the code but if what i understand of what Niall has been > saying you'd use them instead of DynaActionForm. > > > > of course you'll need to call the package and class name to something > appropriate. > > On 9 Mar 2004, at 09:47, shanmugampl wrote: > > > Hi, > > > >I saw your code. I have one doubt. How do you plugin your own > > DynaBean implementation into the struts framework. > > > > Shanmugam PL > > > > Niall Pemberton wrote: > > > >> I wrote these > >> > >> http://www.niallp.pwp.blueyonder.co.uk > >> > >> Niall > >> > >> - Original Message - From: "shanmugampl" > >> <[EMAIL PROTECTED]> > >> To: <[EMAIL PROTECTED]> > >> Sent: Wednesday, February 25, 2004 7:00 AM > >> Subject: Populating form Elements from another object. > >> > >> > >> > >>> Hi, > >>> > >>> I have a requirement where i need to populate the values of a > >>> form from another object, and then again transform the contents of > >>> the form back to the object once the form is submitted. i.e Say, > >>> when i click a button, i do some functionalities and have a > >>> Properties object as an output. The keys in the Properties object > >>> are not static. These values need to be shown in a form. As the keys > >>> retrieved for the current operation is not known, i cant define the > >>> values in the struts-config.xml for the dynaactionclass. > >>> > >>> Is it possible to extend the dynaactionclass, and during its > >>> init or something, iterate the properties object and populate the > >>> form. Are there any other way of doing it. > >>> > >>> Thanks > >>> Shanmugam PL > >>> > >>> > >>> - > >>> 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] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Populating form Elements from another object.
I haven't seen the code but if what i understand of what Niall has been saying you'd use them instead of DynaActionForm. of course you'll need to call the package and class name to something appropriate. On 9 Mar 2004, at 09:47, shanmugampl wrote: Hi, I saw your code. I have one doubt. How do you plugin your own DynaBean implementation into the struts framework. Shanmugam PL Niall Pemberton wrote: I wrote these http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "shanmugampl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 25, 2004 7:00 AM Subject: Populating form Elements from another object. Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - 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: Populating form Elements from another object.
Hi, I saw your code. I have one doubt. How do you plugin your own DynaBean implementation into the struts framework. Shanmugam PL Niall Pemberton wrote: I wrote these http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "shanmugampl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 25, 2004 7:00 AM Subject: Populating form Elements from another object. Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - 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: Populating form Elements from another object.
I wrote these http://www.niallp.pwp.blueyonder.co.uk Niall - Original Message - From: "shanmugampl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, February 25, 2004 7:00 AM Subject: Populating form Elements from another object. > Hi, > > I have a requirement where i need to populate the values of a form > from another object, and then again transform the contents of the form > back to the object once the form is submitted. i.e Say, when i click a > button, i do some functionalities and have a Properties object as an > output. The keys in the Properties object are not static. These values > need to be shown in a form. As the keys retrieved for the current > operation is not known, i cant define the values in the > struts-config.xml for the dynaactionclass. > >Is it possible to extend the dynaactionclass, and during its init > or something, iterate the properties object and populate the form. Are > there any other way of doing it. > > Thanks > Shanmugam PL > > > - > 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: Populating form Elements from another object.
Hi, This is what i have understood - Button Click -> An action class -> Showing a form that needs to be populated. In the action class u may have got the desired data. Assciate the form bean to this action class. Doing this u can get a reference to the Action Form in the execute(). Now do - DynaActionForm form = (DynaActionForm)formBean; form.set("PROPERTY_NAME", "PROPERTY_VALUE"); Doing this, the form bean is populated when u forward to the jsp displaying the required values. Hope this helps Regards, Janarthan S shanmugampl <[EMAIL PROTECTED]> wrote: Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.
Populating form Elements from another object.
Hi, I have a requirement where i need to populate the values of a form from another object, and then again transform the contents of the form back to the object once the form is submitted. i.e Say, when i click a button, i do some functionalities and have a Properties object as an output. The keys in the Properties object are not static. These values need to be shown in a form. As the keys retrieved for the current operation is not known, i cant define the values in the struts-config.xml for the dynaactionclass. Is it possible to extend the dynaactionclass, and during its init or something, iterate the properties object and populate the form. Are there any other way of doing it. Thanks Shanmugam PL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]