RE: Map Backed Action Form
Vishal, First of all. Quit whining. We are not here to just answer YOUR questions. You would get better responses if you read http://www.catb.org/~esr/faqs/smart-questions.html, read the FAQs, and did a search in the archives. Have you read the documentation? There is how-to guide there that describes what to do. http://localhost/struts-docs/faqs/indexedprops.html You could also search the archives as this question is covered often. If you are using a mapped backed form just to avoid writing ActionForm classes, then you should look at DynaForms. You will find that they are better for this purpose. I personally think you are going down the wrong path because you will not be able to use the validation feature of the Validator very easily with your approach. Regards, Richard -Original Message- From: Agashivala, Vishal [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 4:17 AM To: Struts Users Mailing List Subject: RE: Map Backed Action Form Hi Can anyone help me to implement MAP BACKED ACTION FORM??? In this forum, I see 100 of mails but wht I am try to get help on is not there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME irrelevant info here?? If so atleast write to me so that i can think of other way to work around..Atlest some one reply to my message Regards, Vishal Agashivala -Original Message- From: Agashivala, Vishal [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:17 PM To: Struts (E-mail) Subject: Map Backed Action Form can you pls reply how do i implemt the Map Backed ActionForm since its not working at my end...if possible can u send snippet of struts-config.xml and uractionform.java file for refrence Regards, Vishal Agashivala - 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: Map Backed Action Form
Thank you sir.. I got the value now in the Action class...Now I ll go ahead with my design..if need some help knock you Thanks and Regards, Vishal Agashivala Atos Origin India O: +91-22-5691 3870 -Original Message- From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 4:27 PM To: Struts Users Mailing List Subject: Re: Map Backed Action Form In fact the link I have sent you tells you, what you should add in the property attribute : try now. Ovidiu - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 11:55 AM Subject: RE: Map Backed Action Form > As you have suggested I have updated my jsp as shown below- > BUT NOW it gives me error "No getter method for property username of bean > org.apache.struts.taglib.html.BEAN".. i think it tries to find the > getUsername and getPassword.. And in my ActionForm bean has only getValue > and setValue functions...How do i deal with this now? > > > <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> > > > Login Page > > > Login > > scope="request"> > > Username: > Password: > > > > > > > > Regards, > Vishal Agashivala > Atos Origin India > O: +91-22-5691 3870 > > > -Original Message- > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 3:46 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > The jsp you're using for this example should contain the struts > taglibs and > should look like this > > > Login > Password: > > > Ovidiu > - Original Message - > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, November 20, 2003 11:14 AM > Subject: RE: Map Backed Action Form > > > > See basically currently I am just testing so I know what > key/value are there > > in that HASHMAP. So i am just directly querring the username > and password > > but it did not show up the value which i v inserted in those > field of JSPs > > rather it prints 'null' for both. So i dont know where I am > wrong and is > > there any other setting / procedure i v to make. Is anything wrong in > > struts-config > > > > Regards, > > Vishal Agashivala > > Atos Origin India > > O: +91-22-5691 3870 > > > > > > -Original Message- > > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > > Sent: Thursday, November 20, 2003 3:13 PM > > To: Struts Users Mailing List > > Subject: Re: Map Backed Action Form > > > > > > In your Action, CommonEventHandler , you'll decide, based on > > tha value of a > > certain field, which should be present in all your jsp and > > let's call it op, > > what you should do . So for example > > in your CommonEventHandler you'll have > > public ActionForward execute(ActionMapping mapping, ActionForm form, > > HttpServletRequest request, HttpServletResponse response) > > throws Exception > > { > > GenForm gform = (GenForm)form; > > String op = (String)gform.getValue("op"); > > if(op.equals("Signin")){ > > String login = (String)gform.getValue("login"); > > String password = (String)gform.getValue("password"); > > //do your stuff here > > }else if(op.equals("Signout")){ > > .. > > } > > } > > So based on your op parameter you'll know what you have in your > > GenForm each > > time you're executing CommonEventHandler. > > That's a way to do it, but you could also have your > > CommonEventHandler extends > > DispatchAction and implement this in a more clean way > > > > Ovidiu > > > > > > > > - Original Message - > > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Thursday, November 20, 2003 10:09 AM > > Subject: RE: Map Backed Action Form > > > > > > > Hi > > > I have checked the URL which you have suggested but there I > > did not find the > > > example of accessing a field value of form in Action class. > > It only gives to > > > use it JSP via
Re: Map Backed Action Form
In fact the link I have sent you tells you, what you should add in the property attribute : try now. Ovidiu - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 11:55 AM Subject: RE: Map Backed Action Form > As you have suggested I have updated my jsp as shown below- > BUT NOW it gives me error "No getter method for property username of bean > org.apache.struts.taglib.html.BEAN".. i think it tries to find the > getUsername and getPassword.. And in my ActionForm bean has only getValue > and setValue functions...How do i deal with this now? > > > <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> > > > Login Page > > > Login > > scope="request"> > > Username: > Password: > > > > > > > > Regards, > Vishal Agashivala > Atos Origin India > O: +91-22-5691 3870 > > > -Original Message- > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 3:46 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > The jsp you're using for this example should contain the struts > taglibs and > should look like this > > > Login > Password: > > > Ovidiu > - Original Message - > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, November 20, 2003 11:14 AM > Subject: RE: Map Backed Action Form > > > > See basically currently I am just testing so I know what > key/value are there > > in that HASHMAP. So i am just directly querring the username > and password > > but it did not show up the value which i v inserted in those > field of JSPs > > rather it prints 'null' for both. So i dont know where I am > wrong and is > > there any other setting / procedure i v to make. Is anything wrong in > > struts-config > > > > Regards, > > Vishal Agashivala > > Atos Origin India > > O: +91-22-5691 3870 > > > > > > -Original Message- > > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > > Sent: Thursday, November 20, 2003 3:13 PM > > To: Struts Users Mailing List > > Subject: Re: Map Backed Action Form > > > > > > In your Action, CommonEventHandler , you'll decide, based on > > tha value of a > > certain field, which should be present in all your jsp and > > let's call it op, > > what you should do . So for example > > in your CommonEventHandler you'll have > > public ActionForward execute(ActionMapping mapping, ActionForm form, > > HttpServletRequest request, HttpServletResponse response) > > throws Exception > > { > > GenForm gform = (GenForm)form; > > String op = (String)gform.getValue("op"); > > if(op.equals("Signin")){ > > String login = (String)gform.getValue("login"); > > String password = (String)gform.getValue("password"); > > //do your stuff here > > }else if(op.equals("Signout")){ > > .. > > } > > } > > So based on your op parameter you'll know what you have in your > > GenForm each > > time you're executing CommonEventHandler. > > That's a way to do it, but you could also have your > > CommonEventHandler extends > > DispatchAction and implement this in a more clean way > > > > Ovidiu > > > > > > > > - Original Message - > > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Thursday, November 20, 2003 10:09 AM > > Subject: RE: Map Backed Action Form > > > > > > > Hi > > > I have checked the URL which you have suggested but there I > > did not find the > > > example of accessing a field value of form in Action class. > > It only gives to > > > use it JSP via . > > > Can you give me some more information on the same? > > > > > > Thanks and Regards, > > > Vishal Agashivala > > > Atos Origin India > > > O: +91-22-5691 3870 > > > > > > > > > -Original Message- > > > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > > > Sent: Thursday
RE: Map Backed Action Form
As you have suggested I have updated my jsp as shown below- BUT NOW it gives me error "No getter method for property username of bean org.apache.struts.taglib.html.BEAN".. i think it tries to find the getUsername and getPassword.. And in my ActionForm bean has only getValue and setValue functions...How do i deal with this now? <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %> Login Page Login Username: Password: Regards, Vishal Agashivala Atos Origin India O: +91-22-5691 3870 -Original Message- From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 3:46 PM To: Struts Users Mailing List Subject: Re: Map Backed Action Form The jsp you're using for this example should contain the struts taglibs and should look like this Login Password: Ovidiu - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 11:14 AM Subject: RE: Map Backed Action Form > See basically currently I am just testing so I know what key/value are there > in that HASHMAP. So i am just directly querring the username and password > but it did not show up the value which i v inserted in those field of JSPs > rather it prints 'null' for both. So i dont know where I am wrong and is > there any other setting / procedure i v to make. Is anything wrong in > struts-config > > Regards, > Vishal Agashivala > Atos Origin India > O: +91-22-5691 3870 > > > -Original Message- > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 3:13 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > In your Action, CommonEventHandler , you'll decide, based on > tha value of a > certain field, which should be present in all your jsp and > let's call it op, > what you should do . So for example > in your CommonEventHandler you'll have > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) > throws Exception > { > GenForm gform = (GenForm)form; > String op = (String)gform.getValue("op"); > if(op.equals("Signin")){ > String login = (String)gform.getValue("login"); > String password = (String)gform.getValue("password"); > //do your stuff here > }else if(op.equals("Signout")){ > .. > } > } > So based on your op parameter you'll know what you have in your > GenForm each > time you're executing CommonEventHandler. > That's a way to do it, but you could also have your > CommonEventHandler extends > DispatchAction and implement this in a more clean way > > Ovidiu > > > > - Original Message - > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, November 20, 2003 10:09 AM > Subject: RE: Map Backed Action Form > > > > Hi > > I have checked the URL which you have suggested but there I > did not find the > > example of accessing a field value of form in Action class. > It only gives to > > use it JSP via . > > Can you give me some more information on the same? > > > > Thanks and Regards, > > Vishal Agashivala > > Atos Origin India > > O: +91-22-5691 3870 > > > > > > -Original Message- > > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > > Sent: Thursday, November 20, 2003 2:18 PM > > To: Struts Users Mailing List > > Subject: Re: Map Backed Action Form > > > > > > Look here > > http://puneetdelhi.tripod.com/ > > Designing Screens For Variable Number Of Fields > > > > > > - Original Message - > > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Thursday, November 20, 2003 7:17 AM > > Subject: RE: Map Backed Action Form > > > > > > > First up all I like to thanks Rick since you have reply. > > Basically I am new > > > here.. > > > I tried to give all the details- > > > Actually, I am trying to implement the common ActionForm > > which holds the > > > value of the JSP/HTML fields. So then I did not need to > implement the > > > ActionForm for all my jsps. This ActionF
Re: Map Backed Action Form
The jsp you're using for this example should contain the struts taglibs and should look like this Login Password: Ovidiu - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 11:14 AM Subject: RE: Map Backed Action Form > See basically currently I am just testing so I know what key/value are there > in that HASHMAP. So i am just directly querring the username and password > but it did not show up the value which i v inserted in those field of JSPs > rather it prints 'null' for both. So i dont know where I am wrong and is > there any other setting / procedure i v to make. Is anything wrong in > struts-config > > Regards, > Vishal Agashivala > Atos Origin India > O: +91-22-5691 3870 > > > -Original Message- > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 3:13 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > In your Action, CommonEventHandler , you'll decide, based on > tha value of a > certain field, which should be present in all your jsp and > let's call it op, > what you should do . So for example > in your CommonEventHandler you'll have > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) > throws Exception > { > GenForm gform = (GenForm)form; > String op = (String)gform.getValue("op"); > if(op.equals("Signin")){ > String login = (String)gform.getValue("login"); > String password = (String)gform.getValue("password"); > //do your stuff here > }else if(op.equals("Signout")){ > .. > } > } > So based on your op parameter you'll know what you have in your > GenForm each > time you're executing CommonEventHandler. > That's a way to do it, but you could also have your > CommonEventHandler extends > DispatchAction and implement this in a more clean way > > Ovidiu > > > > - Original Message - > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, November 20, 2003 10:09 AM > Subject: RE: Map Backed Action Form > > > > Hi > > I have checked the URL which you have suggested but there I > did not find the > > example of accessing a field value of form in Action class. > It only gives to > > use it JSP via . > > Can you give me some more information on the same? > > > > Thanks and Regards, > > Vishal Agashivala > > Atos Origin India > > O: +91-22-5691 3870 > > > > > > -Original Message- > > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > > Sent: Thursday, November 20, 2003 2:18 PM > > To: Struts Users Mailing List > > Subject: Re: Map Backed Action Form > > > > > > Look here > > http://puneetdelhi.tripod.com/ > > Designing Screens For Variable Number Of Fields > > > > > > - Original Message - > > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Thursday, November 20, 2003 7:17 AM > > Subject: RE: Map Backed Action Form > > > > > > > First up all I like to thanks Rick since you have reply. > > Basically I am new > > > here.. > > > I tried to give all the details- > > > Actually, I am trying to implement the common ActionForm > > which holds the > > > value of the JSP/HTML fields. So then I did not need to > implement the > > > ActionForm for all my jsps. This ActionForm will pass it to > > common Action > > > Class that will be responsible to handle all the events. For > > of now I need > > > this much functionality. > > > To accomplish this I found out in the struts docs that you > > can use 'MAP > > > BACKED ACTIONFORM' so then I have tried that as follows- > > > > > > //Common ActionForm- > > > package com.web.controller; > > > > > > import java.util.Map; > > > import java.util.HashMap; > > > import java.util.Iterator; > > > import org.apache.struts.action.ActionForm; > > > > > > public class GenForm extends ActionForm > > > { > > > private final
RE: Map Backed Action Form
See basically currently I am just testing so I know what key/value are there in that HASHMAP. So i am just directly querring the username and password but it did not show up the value which i v inserted in those field of JSPs rather it prints 'null' for both. So i dont know where I am wrong and is there any other setting / procedure i v to make. Is anything wrong in struts-config Regards, Vishal Agashivala Atos Origin India O: +91-22-5691 3870 -Original Message- From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 3:13 PM To: Struts Users Mailing List Subject: Re: Map Backed Action Form In your Action, CommonEventHandler , you'll decide, based on tha value of a certain field, which should be present in all your jsp and let's call it op, what you should do . So for example in your CommonEventHandler you'll have public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { GenForm gform = (GenForm)form; String op = (String)gform.getValue("op"); if(op.equals("Signin")){ String login = (String)gform.getValue("login"); String password = (String)gform.getValue("password"); //do your stuff here }else if(op.equals("Signout")){ .. } } So based on your op parameter you'll know what you have in your GenForm each time you're executing CommonEventHandler. That's a way to do it, but you could also have your CommonEventHandler extends DispatchAction and implement this in a more clean way Ovidiu - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 10:09 AM Subject: RE: Map Backed Action Form > Hi > I have checked the URL which you have suggested but there I did not find the > example of accessing a field value of form in Action class. It only gives to > use it JSP via . > Can you give me some more information on the same? > > Thanks and Regards, > Vishal Agashivala > Atos Origin India > O: +91-22-5691 3870 > > > -----Original Message----- > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 2:18 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > Look here > http://puneetdelhi.tripod.com/ > Designing Screens For Variable Number Of Fields > > > - Original Message - > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, November 20, 2003 7:17 AM > Subject: RE: Map Backed Action Form > > > > First up all I like to thanks Rick since you have reply. > Basically I am new > > here.. > > I tried to give all the details- > > Actually, I am trying to implement the common ActionForm > which holds the > > value of the JSP/HTML fields. So then I did not need to implement the > > ActionForm for all my jsps. This ActionForm will pass it to > common Action > > Class that will be responsible to handle all the events. For > of now I need > > this much functionality. > > To accomplish this I found out in the struts docs that you > can use 'MAP > > BACKED ACTIONFORM' so then I have tried that as follows- > > > > //Common ActionForm- > > package com.web.controller; > > > > import java.util.Map; > > import java.util.HashMap; > > import java.util.Iterator; > > import org.apache.struts.action.ActionForm; > > > > public class GenForm extends ActionForm > > { > > private final Map values = new HashMap(); > > > > public void GenForm() > > { > > System.out.println("GenForm Constructor"); > > } > > public void setValue(String key, Object value) > > { > > System.out.println("Keys=" + key + " ;value=" + value); > > values.put(key, value); > > } > > > > public Object getValue(String key) { > > return values.get(key); > > } > > } > > > > //Common Action Class > > package com.web.controller; > > import java.lang.reflect.Field; > > import java.lang.reflect.Method; > > import java.lang.reflect.Modifier; > > import java.util.Enumeration; > > import javax.servlet.http.HttpServletRequest; > > import javax.servlet.http.HttpServletResponse; > > > > > > import org.apac
Re: Map Backed Action Form
In your Action, CommonEventHandler , you'll decide, based on tha value of a certain field, which should be present in all your jsp and let's call it op, what you should do . So for example in your CommonEventHandler you'll have public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { GenForm gform = (GenForm)form; String op = (String)gform.getValue("op"); if(op.equals("Signin")){ String login = (String)gform.getValue("login"); String password = (String)gform.getValue("password"); //do your stuff here }else if(op.equals("Signout")){ .. } } So based on your op parameter you'll know what you have in your GenForm each time you're executing CommonEventHandler. That's a way to do it, but you could also have your CommonEventHandler extends DispatchAction and implement this in a more clean way Ovidiu - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 10:09 AM Subject: RE: Map Backed Action Form > Hi > I have checked the URL which you have suggested but there I did not find the > example of accessing a field value of form in Action class. It only gives to > use it JSP via . > Can you give me some more information on the same? > > Thanks and Regards, > Vishal Agashivala > Atos Origin India > O: +91-22-5691 3870 > > > -Original Message- > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 2:18 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > Look here > http://puneetdelhi.tripod.com/ > Designing Screens For Variable Number Of Fields > > > ----- Original Message - > From: "Agashivala, Vishal" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Thursday, November 20, 2003 7:17 AM > Subject: RE: Map Backed Action Form > > > > First up all I like to thanks Rick since you have reply. > Basically I am new > > here.. > > I tried to give all the details- > > Actually, I am trying to implement the common ActionForm > which holds the > > value of the JSP/HTML fields. So then I did not need to implement the > > ActionForm for all my jsps. This ActionForm will pass it to > common Action > > Class that will be responsible to handle all the events. For > of now I need > > this much functionality. > > To accomplish this I found out in the struts docs that you > can use 'MAP > > BACKED ACTIONFORM' so then I have tried that as follows- > > > > //Common ActionForm- > > package com.web.controller; > > > > import java.util.Map; > > import java.util.HashMap; > > import java.util.Iterator; > > import org.apache.struts.action.ActionForm; > > > > public class GenForm extends ActionForm > > { > > private final Map values = new HashMap(); > > > > public void GenForm() > > { > > System.out.println("GenForm Constructor"); > > } > > public void setValue(String key, Object value) > > { > > System.out.println("Keys=" + key + " ;value=" + value); > > values.put(key, value); > > } > > > > public Object getValue(String key) { > > return values.get(key); > > } > > } > > > > //Common Action Class > > package com.web.controller; > > import java.lang.reflect.Field; > > import java.lang.reflect.Method; > > import java.lang.reflect.Modifier; > > import java.util.Enumeration; > > import javax.servlet.http.HttpServletRequest; > > import javax.servlet.http.HttpServletResponse; > > > > > > import org.apache.struts.action.Action; > > import org.apache.struts.action.ActionForward; > > import org.apache.struts.action.ActionMapping; > > import org.apache.struts.action.ActionForm; > > import org.apache.struts.config.impl.ModuleConfigImpl; > > > > import com.web.controller.GenForm; > > > > > > public class CommonEventHandler extends Action > > { > > > > public ActionForward execute(ActionMapping mapping, > ActionForm form, > > HttpServletRequest request, HttpServletResponse response) > throws Exception > > { > > System.out.print
RE: Map Backed Action Form
Hi I have checked the URL which you have suggested but there I did not find the example of accessing a field value of form in Action class. It only gives to use it JSP via . Can you give me some more information on the same? Thanks and Regards, Vishal Agashivala Atos Origin India O: +91-22-5691 3870 -Original Message- From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED] Sent: Thursday, November 20, 2003 2:18 PM To: Struts Users Mailing List Subject: Re: Map Backed Action Form Look here http://puneetdelhi.tripod.com/ Designing Screens For Variable Number Of Fields - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 7:17 AM Subject: RE: Map Backed Action Form > First up all I like to thanks Rick since you have reply. Basically I am new > here.. > I tried to give all the details- > Actually, I am trying to implement the common ActionForm which holds the > value of the JSP/HTML fields. So then I did not need to implement the > ActionForm for all my jsps. This ActionForm will pass it to common Action > Class that will be responsible to handle all the events. For of now I need > this much functionality. > To accomplish this I found out in the struts docs that you can use 'MAP > BACKED ACTIONFORM' so then I have tried that as follows- > > //Common ActionForm- > package com.web.controller; > > import java.util.Map; > import java.util.HashMap; > import java.util.Iterator; > import org.apache.struts.action.ActionForm; > > public class GenForm extends ActionForm > { > private final Map values = new HashMap(); > > public void GenForm() > { > System.out.println("GenForm Constructor"); > } > public void setValue(String key, Object value) > { > System.out.println("Keys=" + key + " ;value=" + value); > values.put(key, value); > } > > public Object getValue(String key) { > return values.get(key); > } > } > > //Common Action Class > package com.web.controller; > import java.lang.reflect.Field; > import java.lang.reflect.Method; > import java.lang.reflect.Modifier; > import java.util.Enumeration; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > > > import org.apache.struts.action.Action; > import org.apache.struts.action.ActionForward; > import org.apache.struts.action.ActionMapping; > import org.apache.struts.action.ActionForm; > import org.apache.struts.config.impl.ModuleConfigImpl; > > import com.web.controller.GenForm; > > > public class CommonEventHandler extends Action > { > > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) throws Exception > { > System.out.println("reached here"); > > if (form == null) > { > System.out.println("Action Form is null"); > } > else > { > System.out.println("Action Form is Filled"); > > } > > System.out.println(((GenForm)form).getValue("username")); > return null; > } > > //struts-config Entries > > > type="com.web.controller.GenForm"/> > > > > type="com.web.controller.CommonEventHandler" > name="GenForm" > scope="request" >validate="false" >input="login.jsp"> > > > > > //Login JSP > > > Login Page > > > Login > > > Username: > Password: > > > > > > Now, for of now I have not coded forward and all.. If in the Action Class, I > ll get fields value for username and password then I can go ahead. Control > has reached upto CommonEventHandler Action class but ActionForm has not > filled up with the username and password? > > So, now my questions are - > 1. Is am I on a right track??? > 2. Is this possible in Struts Framework what I need? > 3. Is there any other way around or any other framwork which I can use to > accomplish my requirement? > > Kindly get back to me If you have any further queries. Expecting some one > will help me in this struts world. > > Thanks and Regards, > Vishal Agashivala > > -Original Message- > From: Rick Reumann [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 10:20 PM > To:
Re: Map Backed Action Form
Look here http://puneetdelhi.tripod.com/ Designing Screens For Variable Number Of Fields - Original Message - From: "Agashivala, Vishal" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 20, 2003 7:17 AM Subject: RE: Map Backed Action Form > First up all I like to thanks Rick since you have reply. Basically I am new > here.. > I tried to give all the details- > Actually, I am trying to implement the common ActionForm which holds the > value of the JSP/HTML fields. So then I did not need to implement the > ActionForm for all my jsps. This ActionForm will pass it to common Action > Class that will be responsible to handle all the events. For of now I need > this much functionality. > To accomplish this I found out in the struts docs that you can use 'MAP > BACKED ACTIONFORM' so then I have tried that as follows- > > //Common ActionForm- > package com.web.controller; > > import java.util.Map; > import java.util.HashMap; > import java.util.Iterator; > import org.apache.struts.action.ActionForm; > > public class GenForm extends ActionForm > { > private final Map values = new HashMap(); > > public void GenForm() > { > System.out.println("GenForm Constructor"); > } > public void setValue(String key, Object value) > { > System.out.println("Keys=" + key + " ;value=" + value); > values.put(key, value); > } > > public Object getValue(String key) { > return values.get(key); > } > } > > //Common Action Class > package com.web.controller; > import java.lang.reflect.Field; > import java.lang.reflect.Method; > import java.lang.reflect.Modifier; > import java.util.Enumeration; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > > > import org.apache.struts.action.Action; > import org.apache.struts.action.ActionForward; > import org.apache.struts.action.ActionMapping; > import org.apache.struts.action.ActionForm; > import org.apache.struts.config.impl.ModuleConfigImpl; > > import com.web.controller.GenForm; > > > public class CommonEventHandler extends Action > { > > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) throws Exception > { > System.out.println("reached here"); > > if (form == null) > { > System.out.println("Action Form is null"); > } > else > { > System.out.println("Action Form is Filled"); > > } > > System.out.println(((GenForm)form).getValue("username")); > return null; > } > > //struts-config Entries > > > type="com.web.controller.GenForm"/> > > > > type="com.web.controller.CommonEventHandler" > name="GenForm" > scope="request" >validate="false" >input="login.jsp"> > > > > > //Login JSP > > > Login Page > > > Login > > > Username: > Password: > > > > > > Now, for of now I have not coded forward and all.. If in the Action Class, I > ll get fields value for username and password then I can go ahead. Control > has reached upto CommonEventHandler Action class but ActionForm has not > filled up with the username and password? > > So, now my questions are - > 1. Is am I on a right track??? > 2. Is this possible in Struts Framework what I need? > 3. Is there any other way around or any other framwork which I can use to > accomplish my requirement? > > Kindly get back to me If you have any further queries. Expecting some one > will help me in this struts world. > > Thanks and Regards, > Vishal Agashivala > > -Original Message- > From: Rick Reumann [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 19, 2003 10:20 PM > To: Struts Users Mailing List > Subject: Re: Map Backed Action Form > > > Agashivala, Vishal wrote: > > > Hi > > Can anyone help me to implement MAP BACKED ACTION FORM??? > > In this forum, I see 100 of mails but wht I am try to get > help on is not > > there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME > irrelevant info > > here?? If so atleast write to me so that i can think of other > way to work > > around..Atlest some one r
RE: Map Backed Action Form
First up all I like to thanks Rick since you have reply. Basically I am new here.. I tried to give all the details- Actually, I am trying to implement the common ActionForm which holds the value of the JSP/HTML fields. So then I did not need to implement the ActionForm for all my jsps. This ActionForm will pass it to common Action Class that will be responsible to handle all the events. For of now I need this much functionality. To accomplish this I found out in the struts docs that you can use 'MAP BACKED ACTIONFORM' so then I have tried that as follows- //Common ActionForm- package com.web.controller; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import org.apache.struts.action.ActionForm; public class GenForm extends ActionForm { private final Map values = new HashMap(); public void GenForm() { System.out.println("GenForm Constructor"); } public void setValue(String key, Object value) { System.out.println("Keys=" + key + " ;value=" + value); values.put(key, value); } public Object getValue(String key) { return values.get(key); } } //Common Action Class package com.web.controller; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Enumeration; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.struts.config.impl.ModuleConfigImpl; import com.web.controller.GenForm; public class CommonEventHandler extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("reached here"); if (form == null) { System.out.println("Action Form is null"); } else { System.out.println("Action Form is Filled"); } System.out.println(((GenForm)form).getValue("username")); return null; } //struts-config Entries //Login JSP Login Page Login Username: Password: Now, for of now I have not coded forward and all.. If in the Action Class, I ll get fields value for username and password then I can go ahead. Control has reached upto CommonEventHandler Action class but ActionForm has not filled up with the username and password? So, now my questions are - 1. Is am I on a right track??? 2. Is this possible in Struts Framework what I need? 3. Is there any other way around or any other framwork which I can use to accomplish my requirement? Kindly get back to me If you have any further queries. Expecting some one will help me in this struts world. Thanks and Regards, Vishal Agashivala -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 10:20 PM To: Struts Users Mailing List Subject: Re: Map Backed Action Form Agashivala, Vishal wrote: > Hi > Can anyone help me to implement MAP BACKED ACTION FORM??? > In this forum, I see 100 of mails but wht I am try to get help on is not > there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME irrelevant info > here?? If so atleast write to me so that i can think of other way to work > around..Atlest some one reply to my message > Regards, Why don't you explain what you need help with? Like what you have tried so far? What you want to accomplish? What isn't working? Anything would be helpful to give us some direction. My first question would be why do you want to back your form by a Map? -- Rick - 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: Map Backed Action Form
Agashivala, Vishal wrote: Hi Can anyone help me to implement MAP BACKED ACTION FORM??? In this forum, I see 100 of mails but wht I am try to get help on is not there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME irrelevant info here?? If so atleast write to me so that i can think of other way to work around..Atlest some one reply to my message Regards, Why don't you explain what you need help with? Like what you have tried so far? What you want to accomplish? What isn't working? Anything would be helpful to give us some direction. My first question would be why do you want to back your form by a Map? -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Map Backed Action Form
Start here: http://www.catb.org/~esr/faqs/smart-questions.html Paul -Original Message- From: Agashivala, Vishal [mailto:[EMAIL PROTECTED] Sent: 19 November 2003 12:17 To: Struts Users Mailing List Subject: RE: Map Backed Action Form Hi Can anyone help me to implement MAP BACKED ACTION FORM??? In this forum, I see 100 of mails but wht I am try to get help on is not there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME irrelevant info here?? If so atleast write to me so that i can think of other way to work around..Atlest some one reply to my message Regards, Vishal Agashivala -Original Message- From: Agashivala, Vishal [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:17 PM To: Struts (E-mail) Subject: Map Backed Action Form can you pls reply how do i implemt the Map Backed ActionForm since its not working at my end...if possible can u send snippet of struts-config.xml and uractionform.java file for refrence Regards, Vishal Agashivala - 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] ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Map Backed Action Form
Hi Can anyone help me to implement MAP BACKED ACTION FORM??? In this forum, I see 100 of mails but wht I am try to get help on is not there..And NO ONE IS HERE TO HELP ME OUT?? AM I ASKING SOME irrelevant info here?? If so atleast write to me so that i can think of other way to work around..Atlest some one reply to my message Regards, Vishal Agashivala -Original Message- From: Agashivala, Vishal [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 2:17 PM To: Struts (E-mail) Subject: Map Backed Action Form can you pls reply how do i implemt the Map Backed ActionForm since its not working at my end...if possible can u send snippet of struts-config.xml and uractionform.java file for refrence Regards, Vishal Agashivala - 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: Map backed action form
You have not allocated the Properties instance that you will use. private Map properties = new Properties ( ); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 15, 2003 7:00 AM To: Struts Users Mailing List Subject: Map backed action form Hello, I have a problem with my map backed form. When I try to validate the form, when I try to retrieve value it throws a null pointer exception, as if the map was null. I am successful going through my jsp and populating the bean, so i am not sure what is going on. What might be the problem? form: private Map properties; public Map getProperties() { return this.properties; } /** Setter for property properties. * @param properties New value of property properties. * */ public void setProperties(Map properties) { this.properties = properties; } public void setValue(String key, Object value) { properties.put(key, value); } public Object getValue(String key) { return properties.get(key); } struts-config definitions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]