You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jon Ferguson <ca...@btinternet.com> on 2002/03/19 10:20:57 UTC
Re: No getter method for property managerRole of bean list
Hi Yu,
I had a similar problem. I found that order did have something to do with it.
Struts
doesn't seem to check for the required arguments but rather expects a
setter/getter
match similar to:
void setBlob(Blob myBlob)
Blob getBlob()
for a vector of blobs you should have
void setBlobs(Vector blobs)
Vector getBlobs()
or
void setBlobs(int blobIndex, Blob myBlob)
Blob getBlob(int blobIndex)..
it seems that if you attempt to override a set without the accompaning get it
gets
confused... I also found a dependency on order in the class.. (which is a bug)
since
Java reflection does not guarrantee an order...
Cheers,
Jon
Yu, Yanhui" wrote:
> I've fixed this problem when I only use the default getter and default
> setter for the vector field, managerRole. When I override any or both of
> the getter and setter, I have problem. I wonder if Struts does not allow me
> to override or overload any of these getters and setters?
>
> Appreciate any help,
> Yanhui
>
> -----Original Message-----
> From: Yu, Yanhui
> Sent: Thursday, March 14, 2002 1:44 PM
> To: 'Ady Das-O'Toole'; Struts Users Mailing List
> Subject: No getter method for property managerRole of bean list
>
> HI,
>
> I tried to search the list, but can't find a good answer (I thought I saw
> somebody else have similar problem before, but I just can't find the answer
> from the archive :)
>
> I passed a Vector of ManagerBean object in the session and the JSP tries to
> display each ManagerBean (its fields actualy) in the Vector. one of the
> fields of ManagerBean is called managerRole which is again a Vector of
> different roles (String). I get the above error (no getter for managerRole)
> when I do the following in the jsp. Any help please, thanks very much in
> advance.
>
> <jsp:useBean id="mgrList" scope="session" class="java.util.Vector"/>
> <logic:iterate id="list" name="mgrList" >
> <bean:define id="roleList" name="list" property="managerRole"/>
> <tr>
> <td width=30><INPUT type="radio" value="<bean:write name="list"
> property="managerName"/>"></td>
> <td width=300><bean:write name="list" property="managerName"/></td>
> <td width=100><bean:write name="list" property="managerID"/></td>
>
> <td width=200>
> <SELECT size="1">
> <logic:iterate id="alist" name="roleList" >
> <OPTION><bean:write name="alist" /></OPTION>
> </logic:iterate>
> </SELECT>
> </td>
> <td width=400><bean:write name="list"
> property="managerAddress"/></td>
> </tr>
> </logic:iterate>
>
> Here is from the ManagerBean:
> private String managerName = null;
> private String managerID = null;
> private String managerAddress = null;
> private Vector managerRole = new Vector();
>
> public Vector getManagerRole() {
> return managerRole;
> }
>
> public void setManagerRole(String newRole) {
> managerRole.addElement (newRole);
> }
>
> public String getManagerRole(int i) {
> return (String) managerRole.get(i);
> }
>
> public void setManagerRole(String newRole, int i) {
> managerRole.add (i, newRole);
> }
>
>
> <td width=400><bean:write name="list" property="managerAddress"/></td>
> </tr>
> </logic:iterate>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>