File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes count errors  in jsp using validation framwork Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "count errors  in jsp using validation framwork" Watch "count errors  in jsp using validation framwork" New topic
Author

count errors in jsp using validation framwork

hari om
Greenhorn

Joined: Jan 22, 2008
Posts: 2
hi,
I have some 20 fields in my jsp form and I am throwing errors using validation framework's server side validation,
I need to count the no. of errors which will be thrown every time.
Nadda Habba
Greenhorn

Joined: Feb 16, 2005
Posts: 18
All the failed validations will have a corresponging error object in the Errors collection, size method would give the no of error objects and also failed validations.
hari om
Greenhorn

Joined: Jan 22, 2008
Posts: 2
hi
Thanks for the quick replay, but can you give me some code snippet as because I am not using any Actionerrors in my action class I am using only <html:errors/> in my jsp to display errors with the help of validation.xml and properties file.
Nadda Habba
Greenhorn

Joined: Feb 16, 2005
Posts: 18
you could use TagUtilities and get the ErrorMessages stored in the session. You could then display the count on the jsp page. hope this helps
Nadda Habba
Greenhorn

Joined: Feb 16, 2005
Posts: 18
use Global.ERRORKEY to get the name of the parameter which saves the Error object.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: count errors in jsp using validation framwork
 
Similar Threads
How to find out which form generated errors ?
Choosing frameworks etc...
Struts + Error Message Display
error information using javascript
Displaying error in multi page form.