I have two confusions in the <html:errors> tag-
In chapter 10 of the book professional Jakarta Struts 1.1, Listing 10.2 index.jsp, I think <html:errors> tag is incomplete.
I tried to run like this in my own application but it did'nt work.
Code:
<@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<title> struts application </title>
</head>
<body>
<table width="500" border="0" >
<tr>
<td>%nbsp;</td>
</tr>
<tr bgcolor="#36566E">
<td height="68" width="48%">
<div align="center">
<img src="images/hp_logo_worx.gif">
</div>
</td>
</tr>
<tr>
<td>%nbsp;</td>
</tr>
</table>
<html:errors/>-------------------------------(1, property not specified)
<html:form action="Lookup">
<table width=45%" border="0" >
<tr>
<td><bean:message key="app.symbol" /></td>
<td><html:text property="symbol"/></td>-------------(2)
</tr>
<tr>
<td><html:submit/></td>
</tr>
</table>
</html:form>
</body>
</html>
what i know is when we write the <html:error> tag we mention the property name 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 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:errors> will know about the error it refers to.
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 at (3). I dont know what is correct. Plz help me in understanding the true concept.