Hi David, Try the following explanation:
http://marc.theaimsgroup.com/?l=struts-user&m=106123062505746&w=2 > -----Original Message----- > From: David Thielen [mailto:[EMAIL PROTECTED] > Sent: 01 September 2003 23:55 > To: Struts-Users > Subject: How to pre-populate - Husted post doesn't work (or I'm > implementing it wrong) > > > Hi; > > I tried this below but when I did > http://localhost/account/setup/pre it created a form but never > called the action class. Any ideas? > > Also, shouldn't the scope below be session so the same form is used? > > thanks - dave > > > > ------------------------------------------------------------------ > -------------- > > a.. From: Ted Husted > b.. Subject: Re: Pre populate > c.. Date: Mon, 11 Jun 2001 08:20:16 -0700 > > ------------------------------------------------------------------ > -------------- > > Many times pre-processing and post-processing are related, and it can be > convenient to handle both in the same Action class. > > A good way to implement this is to have a seperate Action Mapping for > each task (pre-process and post-process). Both mappings would point to > the same Action but use different (virtual) paths. Like say < > /account/setup/pre > and < /account/setup/post >. These may both use the > same Action class, which could be < package/account/setup.java >. > > The Struts mappings accept an extra "parameter" property that you can > easily test in the Action to see which mapping has been chosen. Your > action can > then process each task differently, and even go to separate locations if > successfuly. By managing this all in the struts-config.xml, you gain a > lot of flexbility. > > In struts-config: > > <action > path="/account/setup/pre" > type="package.account.Setup.java" > name="setupForm" > scope="request" > validate="false" > input="/WEB-INF/jsp/account/setup/Form.jsp" > parameter="pre"> > <forward > name="success" > path="/WEB-INF/jsp/account/setup/Form.jsp"/> > </action> > > <action > path="/account/setup/post" > type="package.account.Setup.java" > name="setupForm" > scope="request" > validate="true" > input="/WEB-INF/jsp/setup/Form.jsp" > parameter="post"> > <forward > name="success" > path="/WEB-INF/jsp/account/setup/View.jsp"/> > </action> > > In your Action: > > String task = mapping.getParameter(); > // handle task for "pre" or task for "post" > // ... > // ... > return (mapping.findForward("success")); > > -- Ted Husted, Husted dot Com, Fairport NY USA. > -- Custom Software ~ Technical Services. > -- Tel 716 737-3463. > -- http://www.husted.com/about/struts/ > > > Kiet Nguyen wrote: > > > > I need to pre-populate my form and do some business processes > prior to load > > a page. Where would be the best place for this. I don't want > to put it in > > the peform method of the "from page". And doing business process at the > > form bean does not seen appropriate. > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003 > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]