The moose likes Struts and the fly likes struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts validation" Watch "struts validation" New topic

struts validation

Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Hi Folks,

I am currently using ValidatorForm for my validations. Since most of the validations are available in the struts provided default validations, I am making use of the same.
However, I'd like to highlight (in red) the form field which is causing the validation to fail. How do I accomplish this? From the <html:errors>, is it possible to know which field(s) has caused the error?

Appreciate your assistance!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Use the <logic:messagesPresent> tag. If you specify a property attribute in this tag, the body will be executed only if there is an error message present for that field. Example:

[ July 09, 2007: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
Bhaskar Reddy
Ranch Hand

Joined: Dec 17, 2002
Posts: 52
Sorry for the delayed reply!
I tried it just now as some other tasks took priority and this worked just great for me.

Thank you Merrill!!
Nyanas Kandhan
Ranch Hand

Joined: Jan 27, 2009
Posts: 35
For an example on Highlighting Error Fields you can refer here.

Struts Highlighting Error Fields

Struts Developer

I agree. Here's the link: http://aspose.com/file-tools
subject: struts validation
Similar Threads
Validations using ActionErros Validate
both javascript and serverside validations running
Regarding validations part of Struts...
Issue when using shale commons validator with JSF
struts validator. stoping on first validation error.