• Post Reply Bookmark Topic Watch Topic
  • New Topic

DynaValidatorForm question:

James Drinkard
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I'm converting a simple simple form application to use the DynaValidatorForm and I believe I have the plugins and xml files configured properly. My question is: how do I code for the validation in the action class? My code is:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
DynaValidatorForm f = (DynaValidatorForm) form;
//ActionErrors errors = new ActionErrors();

ActionErrors errors = f.validate(mapping, request);

// Report any errors we have discovered back to the original form
if (!errors.empty())
saveErrors(request, errors);
return new ActionForward(mapping.getInput());

// Forward control to the specified success in the struts-config.xml file.
return (mapping.findForward("success"));
but ActionErrors never get thrown, even though I use "required" to check for null fields on the submit from the jsp form.

Not sure what I have wrong here.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!