This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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
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?
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.