wood burning stoves 2.0
The moose likes Struts and the fly likes validation with dispatch action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "validation with dispatch action" Watch "validation with dispatch action" New topic

validation with dispatch action

Ramakrishna Bysani

Joined: Sep 29, 2004
Posts: 10
Hi, I am using dispatch action in my project. I am using ValidatorForm for server side validation. In my action i have getInput, getMaster, getModel methods are there. getInput results in displaying the input screen by populating all drop downs.
I dont want validation to be triggered when i am calling getInput method. How to avoid this? Currently i achieved by putting code in form like this.

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
logger.debug("Validating ....");
ActionErrors errors = null;
errors = super.validate(mapping, request);
return errors;


Is there any better way to achieve this? some thing like declarative in some config file? Please help me, thanks in advance

SCJP 1.4
Ramakrishna Bysani

Joined: Sep 29, 2004
Posts: 10
Any one there to help me
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The Validation Framework has some obvious drawbacks when using DispatchAction, the principal one being the one you've experienced: You can't apply different validations for different methods of the same Action class. I'd say the solution you've posted is as good as any.

Consultant, Sima Solutions
Ramakrishna Bysani

Joined: Sep 29, 2004
Posts: 10
Thanks Merrill.
I have finished my work with the same code
I was on vacation and could not see your message, sorry for late reply.
I agree. Here's the link: http://aspose.com/file-tools
subject: validation with dispatch action
It's not a secret anymore!