You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Beal <jb...@gmail.com> on 2005/04/01 15:53:21 UTC

Re: MappingDispatchAction usage

You can turn off the framework's validation, and specifically call
validate in the methods where you want it.

/** Java code off the top of my head; may not compile
public ActionForward create(mapping,form,request,response) {
  ActionErrors validations = form.validate();
  if (validations != null && validations.size() > 0) {
    saveErrors(validations);
    return mapping.getInputForward();
  }
  // continue
}

On Mar 31, 2005 2:33 PM, Nic Werner <we...@sonoma.edu> wrote:
> For the 1.2 users:
>     I have a simple CRUD unit that I'm working on. Instead of creating
> an action for each one, I originally used DispatchAction to merge them
> all into one action. This allowed me to have my Create/Update page
> re-use the same JSP - I included a hidden param for the respective
> method and html:form just pointed to this Action. However, validation
> was applied for all operations, which I don't want for Read/Delete.
> 
> Now, my problem is inverted:
> 
> So, MappingDispatchAction looks like it lets me break out the
> Actions,apply validation to specific actions but still have all the code
> stored in one file. However, I can't see how I can re-use the same JSP
> for Create/Update now. <html:form action> used to call MainMethod.do,
> and pass the Method=Create along with it. Now, I have to call a specific
> .do for Create/Update, etc so this won't work.
> 
> Any ideas on where I'm going wrong? Is there something I'm missing for
> just DispatchAction that would turn the validate off when I don't want it?
> 
> Thanks,
> 
> - Nic.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
Jeff Beal
Webmedx, Inc.
Pittsburgh, PA USA

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org