p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Jakarta Struts (http://p2p.wrox.com/forumdisplay.php?f=117)
-   -   <html:errors /> tag doubt (http://p2p.wrox.com/showthread.php?t=76085)

carox September 7th, 2009 10:30 AM

<html:errors /> tag doubt
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.

<@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

  <title> struts application </title>
<table width="500" border="0" >
<tr bgcolor="#36566E">
  <td height="68" width="48%">
    <div align="center">
      <img src="images/hp_logo_worx.gif">

<html:errors/>-------------------------------(1, property not specified)

<html:form action="Lookup">
  <table width=45%" border="0" >
  <td><bean:message key="app.symbol" /></td>
  <td><html:text property="symbol"/></td>-------------(2)

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.

iamrakesh22 October 13th, 2009 06:51 AM

You dont need to mentioned the property for <html:errors/> tag, it just lists all form errors, its not for single error!

All times are GMT -4. The time now is 10:55 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.