• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

In-line Validation

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone point me in the right direction for putting validation error message beside or below the appropriate validating field? I can only find examples where they just list all the errors at the top of the page, and that is just not very eye pleasing.
Thanks.
 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gregg,
You can pull the actionerrors object out of the pageContext on the jsp page and then pull use the action errors api to pull out the individual error messages. What the html:errors tag does is the same thing just that it pulls out all the action error messages but u cud pull them out one by one.
HTH
 
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<html:errors property="userId"/>
will retrieve only the action error named 'userId'. You can place this anywhere on your page.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thought I would drudge this old post of mine because I am having a problem with putting the validation in-line with the correct field on the form.
When I do <html:errors property="name" /> it also pulls the error.header property and of course that just looks horrible.
First, why does it pull that header automatically and Second, if I just remove that property from the application.properties, will it still work? Or does <html:errors/> need that all the time to function?
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
AFAIK, the header and footer keys are optional: the tag uses them if it finds them, otherwise it just renders the error messages. Of course, if you strip out the header and footer from the resource bundle and you have pages where you do want the header and footer, those will be now be F'd up. Alternatively, you could leave the header and footer and use html:messages for your field-specific errors.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could really care less about the header and footer tags. I always like to just display messages where I want them. Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic