I am newbie to Struts and have a problem with populating DynaActionForm. I have two actions: one to set up userForm and one to process it. 1st one is suposed to grab user info and populate the form. The second one updates user info after the form is submitted. The problem is that the from is not populated. Moreover changing the scope to "session" in action "/user/setUp" results in form being populated with appropriate data. What am I doing wrong in here?

Thanks
Danko

from struts-config.xml
<form-bean name="userForm" type="org.apache.struts.action.DynaActionForm">that
<form-property name="userName" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="fullName" type="java.lang.String"/>
<form-property name="email" type="java.lang.String"/>
<form-property name="status" type="java.lang.Integer" initial="0"/>
</form-bean>


<action
path="/user/setUp"
type="myPackage.user.SetUpUserAction"
name="userForm"
scope="request"
validate="false">
<forward name="Success" path="/WEB-INF/jsp/user/userForm.jsp"/>
</action>
<action
path="/user/update"
type="myPackage.user.UpdateUserAction"
name="userForm"
scope="request"
validate="true"
input="/WEB-INF/jsp/user/userForm.jsp">
<forward name="Success" path="/user/edit.do" redirect="true"/>
</action>


from SetUpUserAction.execute()
DynaActionForm userForm = (DynaActionForm)form;
userForm.set("userName",user.getUserName());
userForm.set("password",user.getPassword());
userForm.set("fullName",user.getFullName());
userForm.set("email",user.getEmail());
userForm.set("status",new Integer(1));
forward = mapping.findForward("Success");
return forward;



from userForm.jsp
<html:form action="/user/update.do">
<table cellpadding="2" cellspacing="2" border="1" width="800px">
<tr>
<td class="fieldHeader" colspan="4">UPDATE USER</td>
</tr>
<tr>
<td class="fieldName">Username</td>
<td><html:text property="userName"/></td>
</tr>
......
<tr>
<td class="fieldName">Status</td>
<td><html:radio property="status" value="1"/>Active &nbsp <html:radio property="status" value="0"/>Inactive </td>
</tr>
<tr>
<td colspan="4" class="fieldName" align="center">
<html:submit value="UPDATE"/>
</td>
</tr>
</table>
</html:form>



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to