In the input of second mapping try this /showy.do. Because after validate, you have to populate the form values again ....
Let me know this works -----Original Message----- From: Tuna Vardar [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 6:58 PM To: [EMAIL PROTECTED] Subject: Lost form data after form.validate() and issuing error messages Hello, I lose all form data if validate returns error for the form input. If action goes through validation without creating of any errors, XAction works fine. ShowXAction is used to display jsp and jsp posts to XAction. Any comments? You can see the code below. cheers, tuna ************************* ShowXAction.java looks like follows: public final class ShowXAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ // Update form data if (form == null) { form = new XForm(); if ("request".equals(mapping.getScope())) request.setAttribute(mapping.getAttribute(), form); else session.setAttribute(mapping.getAttribute(), form); } XForm f = (XForm)form; f.setA("..."); f.setB("..."); //ensure, that form is submited only once saveToken(request); return mapping.findForward("success"); } XAction.java looks like: public final class XAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { XForm f = (XForm)form; XBean b = new XBean(f.getA(), f.getB()); b.store(); //ensure, that form is submited only once saveToken(request); return mapping.findForward("success"); } and struts-config.xml is like follows: <!-- --> <action path="/showx" attribute="XForm" scope="request" validate="false" type="com.xxx.yyy.ShowXAction"> <forward name="success" path="/x.jsp"/> </action> <!-- --> <action path="/x" name="XForm" scope="request" input="/x.do" validate="true" type="com.xxx.yyy.XAction"> <forward name="success" path="/showy.do"/> </action> and finally XForm is like follows: public final class XForm extends ActionForm { private String a = null; private String b = null; public String getA() { return this.a; } public void setA(String a) { this.a = a; } public String getB() { return this.b; } public void setB(String b) { this.b = b; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.a = null; this.b = null; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((this.a == null) || (this.a.trim().length() == 0)) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("form.a.missing")); } if ((this.b == null) || (this.b.trim().length() == 0)) { errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("form.b.missing")); } return errors; } public String toString() { StringBuffer sb = new StringBuffer("XForm["); sb.append("a=").append(this.a); sb.append(",b=").append(this.b); return sb.toString(); } } --------------------------------------------------------------------- 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]