struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jana Navaneethan" <jana.navaneet...@labs.gte.com>
Subject Re: Problem with <logic:iterate> using Vector?
Date Wed, 13 Nov 2002 18:20:34 GMT
Hi Brian,
               Thanks for your help I appreciate it. Actually I have a
ViewListingBean which represents the Object in the listingsSummary Vector.
In my JSP, I have already defined bean like this
<jsp:useBean id="viewListing" scope="session" type="com.ViewListingBean"/>

When I try to use same id "viewListing" in my iterate tag it complains about
the id been already defined?
I need to use the "viewListing" bean id for displaying some other properties
in my JSP page. Now how do I define my id in iterate tag? which reperesents
the same bean.

Actual error message is
No bean found under attribute key viewListingBean

Thanks,
Jana.

----- Original Message -----
From: "Brian Hickey" <bhickey@r-effects.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Wednesday, November 13, 2002 12:45 PM
Subject: Re: Problem with <logic:iterate> using Vector?


> Jana,
>
> It would help to see the actual error.
>
> More below...
> > Hi,
> >        I have a Vector in my form bean which contains multiple Objects,
I
> > want to loop through the contents of this Vector in my JSP page, I have
a
> > getListingsSummary() method in my form bean which is viewListingForm,
But
> > for some reason when I call my JSP it throws some exception like
> > No bean found under attribute key viewListingBean
> >
> > Here is my iterate tag
> > <logic:iterate id="viewListingBean" name="viewListingForm"
> > property="listingsSummary">
>
> This says you have a bean named "ViewListingForm" that has some scope
> (request/session) in your JSP. Also that you will refer to that items in
the
> property collection in "listingsSummary" by the scripting variable
> "ViewListingBean". The property accesses the collection (List/Vector) you
> want by calling the form getter for "listingsSummary".
>
> To be thorough, you will need to include the "type" attribute to identify
> the object type that will be found in the collection "listingsSummary". It
> looks like type="java.util.Vector".
>
> >
> > Here is my form Bean
> >
> >    public Vector getListingsSummary()
> >    {
> >       return(this.listingsSummary);
> >    }
> >
> > public void setListingsSummary(Vector listingsSummary)
> >    {
> >       this.listingsSummary = listingsSummary;
> >    }
> >
>
> The getter will be called by the iterate tag for "listingsSummary" and you
> have the case correct.
>
> >
> > My Action class sets the form bean before forwarding to the JSP page..
> >
> > ViewListingForm listingform = (ViewListingForm) form;
> > listingform.setListingsSummary(listingsSummary);
> >
> >
> > BTW what is this id means in the iterate tag? Any help would be greatly
> > appreciated!
>
> Always check the Javadoc (start at: http://jakarta.apache.org/struts/ ).
The
> "id" attribute names the scripting variable you will use within the
iterate
> tag. In other words, each object contained in the Vector "listingsSummary"
> will be referred to as "ViewListingBean".
>
> So you can now use ViewListingBean to access the individual properties of
> the objects in your listingsSummary. For example <bean:write
> name="ViewListingBean" property="someProperty"/>
>
> >
> > Thanks in advance,
> > Jana.
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message