How many items are in the collection?  Four?  Show us the class
represented by your "employee" object.  That is probably the key.

> -----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]

Reply via email to