You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Howard Miller <h....@admin.gla.ac.uk> on 2002/08/27 17:05:27 UTC

Iterate: No getter method problem

Hi,

I simply cannot get the <logic:iterate> tag to work. All I get is a "no
getter method for...." error message, when there IS a getter method in the
bean. 

Worse still I don't understand the documentation. Please excuse me copying a
chunk, but to be clear:

>From the UserGuide....
example: 
<%
    java.util.ArrayList list = new java.util.ArrayList();
    list.add("First");
    list.add("Second");
    list.add("Third");
    list.add("Fourth");
    list.add("Fifth");
    pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
%>

<logic:iterate id="myCollectionElement" name="list">
  Do something with myCollectionElement
</logic:iterate>

...to my mind, what is being added to the pagecontext is not a bean its the
list! so name="list" refers not to a been but to an instance of an ArrayList
object. I don't get this at all, can somebody help me out?

My tag looks like:

<logic:iterate id="....." name="mybean" property="List"> etc.

in the bean (which it finds, because when I had the name wrong I got a
"can't find bean in any scope message", I simply have

public ArrayList getList() {
  return (this.List)
  }

for the record the ArrayList just contains String objects.   I've been
staring at this for around 24 hours and I am completely stuck. Any help
appreciated.

Howard

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Iterate: No getter method problem

Posted by Rejin NS <re...@pitsolutions.com>.
Hello Howard,
    Your mail says:
        "My tag looks like:
        <logic:iterate id="....." name="mybean" property="List"> etc."
    Try changing "List" to "list". Please let me know the result.
Regards,
Rejin.


----- Original Message -----
From: "Howard Miller" <h....@admin.gla.ac.uk>
To: <st...@jakarta.apache.org>
Sent: Tuesday, August 27, 2002 8:35 PM
Subject: Iterate: No getter method problem


> Hi,
>
> I simply cannot get the <logic:iterate> tag to work. All I get is a "no
> getter method for...." error message, when there IS a getter method in the
> bean.
>
> Worse still I don't understand the documentation. Please excuse me copying
a
> chunk, but to be clear:
>
> >From the UserGuide....
> example:
> <%
>     java.util.ArrayList list = new java.util.ArrayList();
>     list.add("First");
>     list.add("Second");
>     list.add("Third");
>     list.add("Fourth");
>     list.add("Fifth");
>     pageContext.setAttribute("list", list, PageContext.PAGE_SCOPE);
> %>
>
> <logic:iterate id="myCollectionElement" name="list">
>   Do something with myCollectionElement
> </logic:iterate>
>
> ...to my mind, what is being added to the pagecontext is not a bean its
the
> list! so name="list" refers not to a been but to an instance of an
ArrayList
> object. I don't get this at all, can somebody help me out?
>
> My tag looks like:
>
> <logic:iterate id="....." name="mybean" property="List"> etc.
>
> in the bean (which it finds, because when I had the name wrong I got a
> "can't find bean in any scope message", I simply have
>
> public ArrayList getList() {
>   return (this.List)
>   }
>
> for the record the ArrayList just contains String objects.   I've been
> staring at this for around 24 hours and I am completely stuck. Any help
> appreciated.
>
> Howard
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>