Yes they are all in the same package. Thanks in advance...
N. -----Original Message----- From: Michael Jouravlev [mailto:[EMAIL PROTECTED] Sent: Wed 11/9/2005 7:12 PM To: Struts Users Mailing List Subject: Re: Map-backed ActionForms PLEASE HELP!!!! >From what you posted it is not obvious that your ActionForm belongs to com.prytaniagroup.www package. Does it? Michael. On 11/9/05, Neil Mendoza <[EMAIL PROTECTED]> wrote: > OK, I'm climbing up the walls trying to make Struts populate a map-backed > action form. This should be a simple task but I cannot get it to f*&king > work and it is driving me insane... The reset method is called before the > form is first displayed and the resulting jsp is populated with the value set > in the reset method, i.e. it's accessing the map correctly. However, when > the form is submitted the reset is called again but the form bean is not > populated from the request before it gets to the action... > > AAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaa.... > > ---------------------------------------------------- > Action Form class > > import java.util.HashMap; > import java.util.Map; > > import javax.servlet.http.HttpServletRequest; > > import org.apache.struts.action.ActionForm; > import org.apache.struts.action.ActionMapping; > > public class StrutsTestForm extends ActionForm { > > private Map things = new HashMap(); > > public void setThing(String key, String value) { > things.put(key, value); > } > public Object getThing(String key) { > return things.get(key); > } > > public void reset( > ActionMapping arg0, > HttpServletRequest arg1) { > setThing("name", "test"); > System.out.println("reset called"); > > } > } > ------------------------------------------------------------ > form jsp > > <%@ taglib uri="/tags/struts-bean" prefix="bean" %> > <%@ taglib uri="/tags/struts-html" prefix="html" %> > <html> > <head> > <title>Employee Form</title> > </head> > <body> > <h1>Employee Form</h1> > <html:form action="sta" focus="name" method="get"> > <table> > <tr> > <td >Name:</td> > <td><html:text property="thing(name)"/></td> > </tr> > <tr> > <td>Age:</td> > <td><html:text property="thing(age)"/></td> > </tr> > </table> > <html:submit>Submit</html:submit> > </html:form> > </body> > </html> > > ----------------------------------------------------------- > Action class > > > package com.prytaniagroup.www; > > 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.commons. > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > > public final class StrutsTestAction extends Action { > > public ActionForward execute(ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) > throws Exception { > StrutsTestForm strutsTestForm = (StrutsTestForm)form; > > System.out.println((String)strutsTestForm.getThing("name")); > > System.out.println((String)strutsTestForm.getThing("age")); > return (mapping.findForward("success")); > } > } > > ---------------------------------------------------------------------------------- > extracts from strusts-config.xml > > <form-beans> > > <form-bean > name="StrutsTestForm" > type="com.prytaniagroup.www.StrutsTestForm"/> > </form-beans> > > <action-mappings> > > <action > path="/setupstrutstestform" > forward="/strutstestform.jsp"/> > > <action > path="/sta" > type="com.prytaniagroup.www.StrutsTestAction" > name="StrutsTestForm" > scope="request" > validate="false"> > > <forward name="success" path="/confirmation.jsp"/> > </action> > > </action-mappings> > > --- > This e-mail may contain confidential and/or privileged information. If you > are not the > intended recipient (or have received this e-mail in error) please notify the > sender > immediately and destroy this e-mail. Any unauthorised copying, disclosure or > distribution > of the material in this e-mail is strictly forbidden. The Prytania Group has > taken every > reasonable precaution to ensure that any attachment to this e-mail has been > swept for > viruses. However, we cannot accept liability for any damage sustained as a > result of > software viruses and would advise that you carry out your own virus checks > before > opening any attachment. > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. The Prytania Group has taken every reasonable precaution to ensure that any attachment to this e-mail has been swept for viruses. However, we cannot accept liability for any damage sustained as a result of software viruses and would advise that you carry out your own virus checks before opening any attachment.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]