This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Struts and the fly likes Show errors in new line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Show errors in new line" Watch "Show errors in new line" New topic
Author

Show errors in new line

Pam Theod
Greenhorn

Joined: Apr 19, 2006
Posts: 14
Hi All,

I have a jsp and on submit, I call the action class. Before submitting the information to database I do form validation and the all the errors are sent back t the jsp to show to the user. I have all these things working the way it should. But when the jsp shows the validation errors , it shows all the errors together which makes it very difficult to read.

How do I show these errors in new line.

Any insight would be greatful.

Thanks in advance.

p pro
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There are a couple of options here. First, you can simply embed a <br> tag at the end of each message you define in your ApplicationResources.properties file. Any HTML tags you put in the message will be rendered on the page.

Another option is to use the <html:messages> tag rather than the <html:errors/> tag. The <html:messages> tags allows you more formatting options.

See the heading "Displaying Messages" in this link.

Here is another good link on messaging in struts:

http://www.systemmobile.com/articles/strutsMessageResources.html


Merrill
Consultant, Sima Solutions
Pam Theod
Greenhorn

Joined: Apr 19, 2006
Posts: 14
Merrill,
<br> at the end of each message in properties file worked.

Thanks you very much!

P
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
"p pro".

Welcome to JavaRanch. We don't have many rules here but we do have a naming policy that we strictly adhere to. Please re-read this naming convention and change your display name in order to comply. Thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Show errors in new line