Has anyone attempted to use programmatic validation in Struts 2? When I add an actionError and return INPUT, it properly goes back to the page with the form, but it does not keep the values that I typed. Shouldn't that work? This is how it worked in Struts 1.

package com.company.action;

import com.opensymphony.xwork2.ActionSupport;


public class ExampleValidateAction extends ActionSupport
{

   private string attribute;

   public String execute() throws Exception
   {

// complicated validation logic. Too complicated for xml validation
       this.addActionError("Validation Error");
       return INPUT;


   }

   public string getAttribute()
   {
      return attribute;
   }

   public void setAttribue(String attr)
   {
      this.attribute = attr;
   }

}

Reply via email to