Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 71084 invoked from network); 9 Nov 2005 20:08:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Nov 2005 20:08:57 -0000 Received: (qmail 33432 invoked by uid 500); 9 Nov 2005 20:08:44 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 33418 invoked by uid 500); 9 Nov 2005 20:08:44 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 33404 invoked by uid 99); 9 Nov 2005 20:08:43 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2005 12:08:43 -0800 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=PLING_PLING X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.42.162.2] (HELO relay1.fastnet.co.uk) (212.42.162.2) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2005 12:08:34 -0800 Received: from hyperion.sol.prytaniagroup.com (host217-36-49-166.in-addr.btopenworld.com [217.36.49.166]) by relay1.fastnet.co.uk (8.12.9p2/8.12.9) with ESMTP id jA9KArIm001198 for ; Wed, 9 Nov 2005 20:10:53 GMT (envelope-from nmendoza@prytaniagroup.com) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C5E569.A48D357D" Subject: RE: Map-backed ActionForms PLEASE HELP!!!! X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 Date: Wed, 9 Nov 2005 20:08:44 -0000 Message-ID: Content-Transfer-Encoding: 7bit X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Map-backed ActionForms PLEASE HELP!!!! Thread-Index: AcXlYhFL/KiFDJqzSDaSwjbOttND2wAB1G4M From: "Neil Mendoza" Importance: normal To: "Struts Users Mailing List" Priority: normal X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C5E569.A48D357D Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Yes they are all in the same package. Thanks in advance... N. -----Original Message----- From: Michael Jouravlev [mailto:jmikus@gmail.com] Sent: Wed 11/9/2005 7:12 PM To: Struts Users Mailing List Subject: Re: Map-backed ActionForms PLEASE HELP!!!! =20 >>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 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 =3D 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=3D"/tags/struts-bean" prefix=3D"bean" %> > <%@ taglib uri=3D"/tags/struts-html" prefix=3D"html" %> > > > Employee Form > > >

Employee Form

> > > > > > > > > > >
Name:
Age:
> Submit >
> > > > ----------------------------------------------------------- > 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 =3D = (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 > > > > name=3D"StrutsTestForm" > type=3D"com.prytaniagroup.www.StrutsTestForm"/> > > > > > path=3D"/setupstrutstestform" > forward=3D"/strutstestform.jsp"/> > > path=3D"/sta" > type=3D"com.prytaniagroup.www.StrutsTestAction" > name=3D"StrutsTestForm" > scope=3D"request" > validate=3D"false"> > > > > > > > --- > 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: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org =20 --- This e-mail may contain confidential and/or privileged information. If = you are not the=20 intended recipient (or have received this e-mail in error) please notify = the sender=20 immediately and destroy this e-mail. Any unauthorised copying, = disclosure or distribution=20 of the material in this e-mail is strictly forbidden. The Prytania Group = has taken every=20 reasonable precaution to ensure that any attachment to this e-mail has = been swept for=20 viruses. However, we cannot accept liability for any damage sustained as = a result of=20 software viruses and would advise that you carry out your own virus = checks before=20 opening any attachment. ------_=_NextPart_001_01C5E569.A48D357D Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org ------_=_NextPart_001_01C5E569.A48D357D--