• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

ActionErrors

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using Struts 1.1. I am to do some validations in my form for this i have written validation method.

In my struts-config.xml validation = "false"

As per my requirement i have to write two validations methods in form bean. (one is for errors and one is for warnings). I am calling both the methods one by one. One methods perform required validations and add to errors. again i call send method to checks for warnings and add in errors. both the method are are working fine.

Only problem i am facing is JSP page display only errors from from last methods (which ever i call second).

Code is

//Checking warnings
ActionErrors errorsWarning = myForm.validateWarning(mapping,(HttpServletRequest) request);

if (!errorsWarning.isEmpty()) {
saveErrors((HttpServletRequest) request, errorsWarning);
}



//Checking error
ActionErrors errors = myForm.validate(mapping,(HttpServletRequest) request);
if (!errors.isEmpty()) {
saveErrors((HttpServletRequest) request, errors);
}

Is there any way so i could display both errors in my JSP

Thank you
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change the signature of your validateWarning method so that it accepts an ActionErrors object as a parameter. Then have the validateWarning method add any new errors to this ActionErrors object rather than creating a new one. Then just make sure you call validateWarning after the validate method and pass the object you get from validate into the validateWarning Method.
[ July 01, 2008: Message edited by: Merrill Higginson ]
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic