Have you done this in the jsp?

<tiles:useAttribute name="topnav" scope="page" />

MArk

On Thu, 2 Dec 2004 12:39:01 -0700, Jim Barrows <[EMAIL PROTECTED]> wrote:
> 
> 
> 
> 
> > -----Original Message-----
> > From: Jerry Rodgers [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, December 02, 2004 12:11 PM
> > To: [EMAIL PROTECTED]
> > Subject: JSTL, Tiles PutList and Tomcat 5.028
> >
> >
> > Hi All,
> >
> >
> >
> > I have a jsp page that I am trying to run on Tomcat that
> > currently works in
> > Weblogic. It appears the primary problem is that the forEach
> > tag is not
> > putting the variable menuItem into the pageContext attributes
> > and or it
> > thinks the menuItem is of type String. I am not sure where my actually
> > problem is (tiles, tomcat etc).
> >
> >
> >
> >
> >
> > It appears Tomcat is generating code when compiling the JSP
> > that isn't aware
> > of the type of class the
> > org.apache.struts.tiles.beans.SimpleMenuItem is -
> > it looks like at run time it thinks it is a String.
> >
> >
> >
> >
> >
> > A snippet of my JSP looks like this (jstl tags - partial):
> >
> > <core:forEach var="menuItem" varStatus="status" items="${topnav}">
> >
> > <core:choose>
> >
> >  <core:when test="${menuItem.tooltip=='help'}">
> 
> I do something similar in my code, and it works.
> It does look like it's not figuring out what type the menuItem is though....
> 
> <snip/>
> 
> 
> 
> >
> > When I check the pageContext attributes via a debugger I
> > actually see an
> > item in the collection with the key "topnav" and it contains
> > a Vector of
> > items that appear to be of type SimpleMenuItem. However I
> > never see the item
> > called menuItem that I thought the forEach tag would place in
> > there for me.
> 
> And I think the tutorial is agreeing with you:
> The forEach tag allows you to iterate over a collection of objects. You 
> specify the collection via the items attribute, and the current item is 
> available through a scope variable named by the item attribute.
> 
> A large number of collection types are supported by forEach, including all 
> implementations of java.util.Collection and java.util.Map. If the items 
> attribute is of type java.util.Map, then the current item will be of type 
> java.util.Map.Entry, which has the following properties:
> 
>     * key - the key under which the item is stored in the underlying Map
>     * value - the value that corresponds to the key
> 
> Arrays of objects as well as arrays of primitive types (for example, int) are 
> also supported. For arrays of primitive types, the current item for the 
> iteration is automatically wrapped with its standard wrapper class (for 
> example, Integer for int, Float for float, and so on).
> 
> Implementations of java.util.Iterator and java.util.Enumeration are supported 
> but these must be used with caution. Iterator and Enumeration objects are not 
> resettable so they should not be used within more than one iteration tag. 
> Finally, java.lang.String objects can be iterated over if the string contains 
> a list of comma separated values (for example: 
> Monday,Tuesday,Wednesday,Thursday,Friday).
> 
> Here's the shopping cart iteration from the previous section with the forEach 
> tag:
> 
> <c:forEach var="item" items="${sessionScope.cart.items}">
>   ...
>   <tr>
>     <td align="right" bgcolor="#ffffff">
>     ${item.quantity}
>   </td>
>   ...
> </c:forEach>
> 
> The forTokens tag is used to iterate over a collection of tokens separated by 
> a delimiter.
> from http://java.sun.com/webservices/docs/1.3/tutorial/doc/index.html
> 
> >
> >
> >
> > Thanks for any help you may be able to provide,
> >
> >
> >
> > Jerry Rodgers
> >
> >
> >
> >
> >
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

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

Reply via email to