This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts validation

 
Ajay Tickle
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ajay Tickle
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Merrill it worked for.

thanks a lot for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic