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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts validation" Watch "struts validation" New topic

struts validation

Ajay Tickle

Joined: Mar 16, 2008
Posts: 17

I am using struts in my application. to validate users entry in jsp i have my validation method. and i am calling that method in action class. code is below I am not using struts' validations )

above code is working fine. Only problem is it is printing error messages in jsp in one line.

example: Enter Name. Enter Address.

I would like to show every error message on new line in jsp. is it possible.

in jsp i am using <html:errors/> to print message.

thank you for your time and solutions
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Struts has some pre-defined message keys that it will use before and after messages: errors.header, prefix, suffix, and footer. Header goes before all messages, and footer after all messages, while prefix goes before each message, and suffix after each message. So, if you want messages listed as part of a list, you could put the following:

If you want a line break between each message, then just specifying errors.suffix=<br> should do it.

Consultant, Sima Solutions
Ajay Tickle

Joined: Mar 16, 2008
Posts: 17
thanks Merrill it worked for.

thanks a lot for your help
I agree. Here's the link:
subject: struts validation
It's not a secret anymore!