Re: Programmatic Validation in Action

2007-06-11 Thread Matt Luce

This issue is related to my other issue with the ModelDriven interface.


RE: ModelDriven interface

2007-06-11 Thread Matt Luce

After working on this for a while, I beginning to think that that
ModelDriven interface is not what I had thought it was.  It is certainly not
a replacement for the formBeans in Struts 1.  I guess I just need to forget
most of what I've used in Struts 1 :) Thanks all for your help.


Programmatic Validation in Action

2007-06-09 Thread Matt Luce
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;
   }

}