> I'm totally confused you say that I need to write these methods 

Here's your iterate tag:

<logic:iterate id="ipAddress" type="com.register.struts.account.IpAddress"
name="editAdvancedForm" property="alist" >  

And here are html:text tags:

<html:text name="ipAddress" property="domainName" indexed="true"/>
<html:text name="ipAddress" property="ipValue" indexed="true"/>

This results in <input type="text"...> elements with the "name" attribute
set to:

ipAddress[0].domainName
ipAddress[0].ipValue

(that's repeated for each element in the array, of course).

When the page is created, Struts calls getAlist() in the editAdvancedForm
bean. That returns an array, and for each element of that array, Struts
calls getDomainName(), and getIpValue()

The page displays, so you know that's working.

When you submit the page, Struts calls getIpAddress(int) in
editAdvancedForm. Why not getAlist(int)? When the page is submitted, the
<logic:iterate...> tag is no longer there. Struts has to figure out what to
do from the "name" attributes of the <input type="text"..> elements.

So the getIpAddress(int) method should return a single bean of type
"com.register.struts.account.IpAddress". Struts then calls setDomainName()
and setIpValue() on the result. In my case, my analog to your getAlist(int)
returned a null, since I hadn't properly initialized my array. Apparently,
your case is that you have a getAlist(int) method, but not a
getIpAddress(int) method.

It *is* confusing. The documentation of <logic:iterate...> says *nothing*
about what getter and setter methods are expected to be where. The error
message is not terribly clear (as you've found out) and does not give any
clue as to where in the jsp page the error arose. Since Struts seems to call
these getters and setters at random (maybe it's reading them out of a hash
table?), there really is no way to tell which one it's working on when it
blows up. It took me *days* to figure out what was going on.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to