Jumping in late, sorry if I've missed something. If you don't specify a "type"
attribute for an "attribute" directive, it defaults to String. Perhaps:

<%@ attribute name="employees" type="java.util.Collection" %>

Quoting Rick Reumann <[EMAIL PROTECTED]>:

> On Sun, Apr 04, 2004 at 10:00:28AM -0700, Karr, David wrote:
> 
> > How many items are in the collection?  Four?  Show us the class
> > represented by your "employee" object.  That is probably the key.
> 
>     Yes four items in this example are in the collection.
>     
>     The only reason I didn't show the Employee object is if I
>     create this forEach loop in a regular JSP, where the
>     employees collection is in scope, the loop works fine. The
>     Employee object(EmployeeVO) has get/sets of the following
>     fields:
> 
>     private String name;
>     private int id;
>     private int age;
>     private int deptId;
>                     
>     The problem is it looks like when I do this inside of the
>     Tag File it thinks the var "employee" represents a String
>     and not the EmployeeVO which the current iteration of the
>     employees loop should represent. 
> 
>     I'm not sure how to get the Tag File to see the var as
>     EmployeeVO and not a String?
> 
>     Thanks again
>     
>     <original posted question below:>
> 
> > > -----Original Message-----
> > > From: Rick Reumann [mailto:[EMAIL PROTECTED] 
> > > Sent: Saturday, April 03, 2004 10:42 PM
> > > To: Tag Libraries Users List
> > > Subject: JSP2.0 Tag File question
> > > 
> > > 
> > > This is just for a demo, but I'm trying to pass in collection 
> > > into a Tag File. I'm doing something wrong though as I'm getting 
> > > 
> > > Unable to find a value for "name" in object of class 
> > > "java.lang.String" using operator "."
> > > 
> > > so, I'm thinking maybe I need to do the following differently 
> > > when in a Tag File. Below is the Tag File:
> > > 
> > > <%@ attribute name="employees" %>
> > > <%@ taglib uri="jstl/c" prefix="c" %>
> > > <table border="0" cellpadding="2" cellspacing="2">
> > >     <tr>
> > >         <th>Name</th>
> > >         <th>Age</th>
> > >         <th>Department</th>
> > >     </tr>
> > > 
> > > <c:forEach var='employee' items='${employees}'>
> > >     <tr>
> > >         <td><a href="">${employee.name}</td>
> > >         <td>${employee.age}</td>
> > >         <td>${employee.deptId}</td>
> > >     </tr>
> > > </c:forEach>
> > > </table>
> > > 
> > > I'm passing in employees from a JSP like:
> > > 
> > > <emp:Employees employees="${employees}"/>
> > > 
> > > The forEach above works fine in a standard JSP. It even 'sort 
> > > of' works in this case also since if I replace the 
> > > <tr>..</tr> section above with 'test<br>', four test lines 
> > > print out. Can you not nest a for each with expressions like 
> > > I'm trying to do in a Tag File?
> > > 
> > > Thanks for any help.
> > > 
> > > -- 
> > > Rick
> > > 
> > > "Before you criticize someone, walk a mile in their shoes.
> > > That way, you'll be a mile from them, and you'll have their shoes."
> > >     </Jack Handey>
> > > 
> > > ---------------------------------------------------------------------
> > > 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]
> > 
> > 
> 
> -- 
> Rick
> 
> "Before you criticize someone, walk a mile in their shoes.
> That way, you'll be a mile from them, and you'll have their shoes."
>     </Jack Handey>

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to