What version of Struts are you using? How are you instantiating your Dyna*Form? Struts 1.1 didn't really have direct support for instantiating DyanForms from an Action object. Struts 1.2.0/nightly build does. Is it possible that you're using 1.1 and instantiating the form incorrectly?
--- "Dean A. Hoover" <[EMAIL PROTECTED]> wrote: > I am using DynaValidatorAction and > it works just fine, when starting "clean". > However, when I attempt to pre-populate > the object, the data never makes it to the > form. Anyone know why? What follows > is some snippets of files that should show > what I am doing. > > === struts-config.xml > <?xml version="1.0" encoding="ISO-8859-1" ?> > <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD > Struts Configuration 1.0//EN" > "http:/jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> > > <struts-config> > <form-beans> > <!-- changeContactInfo --> > <form-bean name="changeContactInfo" > type="org.apache.struts.validator.DynaValidatorForm"> > <form-property name="contactInfoWidgetsSubFormFirstName" > type="java.lang.String"/> > ... > </form-bean> > ... > <global-forwards> > <forward name="welcome" path="/home.do"/> > <forward name="logon" path="/logon.do"/> > <forward name="logout" path="/Logout.do"/> > ... > <forward name="changeContactInfo" path="/ChangeContactInfoSetup.do"/> > ... > </global-forwards> > > <action-mappings> > ... > <!-- changeContactInfo --> > <action path="/ChangeContactInfoSetup" > type="fi.els.action.ChangeContactInfoSetup"> > <forward name="success" path="/changeContactInfo.do"/> > <!-- FIXME --> > <forward name="failure" path="/changeContactInfo.do"/> > </action> > > <action path="/changeContactInfo" > type="org.apache.struts.actions.ForwardAction" > parameter="tiles.changeContactInfo"/> > > <action path="/ChangeContactInfo" > type="fi.els.action.ChangeContactInfo" > name="changeContactInfo" > validate="true" > input="tiles.changeContactInfo" > parameter="method"> > <forward name="success" path="/home.do"/> > <forward name="cancel" path="/home.do"/> > </action> > ... > </action-mappings> > ... > <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> > <set-property property="pathnames" > value="/WEB-INF/validator-rules.xml, > /WEB-INF/validation.xml"/> > </plug-in> > > </struts-config> > === validation.xml > <form-validation> > <formset> > ... > <!-- Change Contact Info --> > <form name="changeContactInfo"> > <field property="contactInfoWidgetsSubFormFirstName" > depends="required,maxlength"> > <arg0 key="contactInfoWidgetsSubForm.label.firstName"/> > <arg1 name="maxlength" key="${var:maxlength}" resource="false"/> > <var> > <var-name>maxlength</var-name> > <var-value>24</var-value> > </var> > </field> > ... > </form> > </formset> > </form-validation> > === ChangeContactInfoSetup.java > package fi.els.action; > ... > public class ChangeContactInfoSetup extends Action > { > public ActionForward execute > ( > ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response > ) throws Exception > { > User user = (User)request.getSession().getAttribute("user"); > > Connection connection = null; > > try > { > DynaValidatorForm vForm = new DynaValidatorForm(); > ... > connection = dataSource.getConnection(); > Client client = Client.load(connection, user.getId()); > ContactInfo contactInfo = client.getContactInfo(); > vForm.set("contactInfoWidgetsSubFormFirstName", > (contactInfo.getFirstName() != null) ? > contactInfo.getFirstName() : ""); > ... > request.getSession().setAttribute("changeContactInfo", vForm); > return mapping.findForward("success"); > } > ... > } > } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]