I hope this code:

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

Is a typo?  If not, this is why your attribute is not being set in your
action class.

Also, since you are forwarding to the same page regardless of success,
failure and input... are you sure it is actually failing and returning
INPUT?


On 6/9/07, Matt Luce <[EMAIL PROTECTED]> wrote:

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