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.
Hi, I'm trying to upgrade my application from struts 1.1 to struts 1.2.4. The problem is I'm using ValidatorForm and I don't know what the code in the jsp should look like to display the error messages. html:messages requires an id and I don't know what the value of the id shoud be if I'm using ValidatorForm.
Only 2 things are infinite in the world... the univers and stupidity!
We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
It doesn't matter if you're using the ValidatorForm. The id attribute follows the standard JSP attribute naming convention: it is the name of a scripting variable. In the earlier versions of Struts, the html:errors tag iterated internally to display error messages. Because of its implementation, you had to include any HTML markup with the message text in your application resources file.
This has since changed. The html:messages now acts like a iteration loop. The current message will be accessible through the variable named by the id attribute. This way, you can keep the markup in the JSP, as it should be, and you only need to specify the message text in your application resources.
[ October 22, 2004: Message edited by: Junilu Lacar ]
But one question is still unanswered... what should I put here: html:messages id="???"... because I'm using FormValidator the struts class does all the work( I'm not building any message object or anything hence I don't have the name of the Message variable).