aren't default scope is session?? i am wondering if I am missing any other point other than scope.
On 7/31/2012 6:20 PM, Paul Benedict wrote:
I think you're losing the data because you're unintentionally creating a new form. Make sure both actions refer to the form with the same scope. On Tue, Jul 31, 2012 at 11:09 AM, Anjib Mulepati<[email protected]> wrote:Hi All, I am using large form to input data. I have some validation code as well as I have condition where if something goes wrong in execution of action it will take the user back to the form. My problem is when validation fail or form returned from action execution all my form data are lost. How can I have form retain its data even after fail? I am using struts tag for form and session scope for form. <html:form styleId="createAgentForm" action="createAgent" focus="agentVersion"> <label for="agentVersion" class="formLabel"><bean:message key="label.agentVersion" />*</label> <html:text property="agentVersion" size="10" styleId="agentVersion" tabindex="1" titleKey="title.agentVersion" value="" /> <br /> ........ <html:submit styleClass="submitbutton" tabindex="11" value="Create Agent" title="Create Agent" /> </html:form> <action path="/createAgent" type="com.anjib.actions.agencyadmin.CreateAgentAction" input="/showCreateAgent.do" name="CreateAgentForm" scope="session"> <forward name="createAgentForm" path="/showCreateAgent.do"/> </action> <action path="/showCreateAgent" type="com.anjib.actions.agencyadmin.ShowCreateAgentAction"> <forward name="success" path="createAgentPage"/> </action> public class CreateAgentForm extends org.apache.struts.action.ActionForm { .............................. public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (getAgentName() == null || getAgentName().length()< 1) { errors.add("createAgent", new ActionMessage("error.agentName.required")); } ................................................. return errors; } } Thanks, Anjib --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

