This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes <html:error> tag doubt in struts 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "<html:error> tag doubt in struts 1 " Watch "<html:error> tag doubt in struts 1 " New topic
Author

<html:error> tag doubt in struts 1

carox kaur
Ranch Hand

Joined: Mar 19, 2009
Posts: 52
I am referring the book :professional Jakarta Struts 1.1, wrox publication. Chapter 10 'Managing errors' describes the process of Error handling in struts application. In Listing 10.2 index.jsp, there are two input controls : name and password, both are textfields. Just after these textfileds <html:error> tag is embeded to catch the errors. The code given in the book is:

what i know is when we write the <html:error> tag we have to mention the 'property' attribute also:
<html:error property="symbol1"/>.-------------------------(3)

The reason this is required is when we make the ActionErrors object, we code like this:
ActionErrors err=new ActionErrors();
err.add("symbol1,new ActionError("keyname"));-----------(4)

So the "symbol1" in the above add method is the value specified in the property at (3). So if we won't specify the property attribute then how will the <html:error> will know about the error it refers to. Which error it will pick from the collection represented by ActionErrors object?

Secondly,In the book at page 169 below listing 10.3 its written that the "symbol1" at 4 is the value of the property of the <html:text> tag at (2).
But I have read that this "symbol1" at (4) corresponds to the value of the property of <html:error > tag at (3). I dont know which is correct. Please help me in understanding the true concept.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Wow, that's an old version of Struts.

<html:errors/> displays *all* the action errors. With a "property" attribute it displays the errors for that property. Just like it says in the documentation.

http://struts.apache.org/1.1/userGuide/struts-html.html#errors

(And as far as I know there is no <html:error> tag--when asking questions it's important to be as precise as possible :)
carox kaur
Ranch Hand

Joined: Mar 19, 2009
Posts: 52
Thanks.....sure I ll take care next time....


Secondly,In the book at page 169 below listing 10.3 its written that the "symbol1" at 4 is the value of the property of the <html:text> tag at (2).
But I have read that this "symbol1" at (4) corresponds to the value of the property of <html:error > tag at (3). I dont know which is correct. Please help me in understanding the true concept.

So that also means that 'symbol1' corresponds to the value of the property of <html:text> tag, according to struts 1.1.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

carox kaur wrote:But I have read that this "symbol1" at (4) corresponds to the value of the property of <html:error > tag at (3). I dont know which is correct. Please help me in understanding the true concept.

<html:errors> look for the property in the action errors/measages. Consider this "property" as a key when it comes to find out the respective error message. Like, if you want to display invalid login info error message, you will do something like this:


And upgrade to the latest Struts version.

[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
 
jQuery in Action, 2nd edition
 
subject: <html:error> tag doubt in struts 1
 
Similar Threads
tags
Problem in SessionManagement in Struts
wrong jar reference
strut exception
how do i use checkbox as an active/inactive button for a form?