jQuery in Action, 3rd edition
The moose likes JSP and the fly likes passing c:forEach value to custom tag as attribute? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

passing c:forEach value to custom tag as attribute?

Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
Hi all
i just overcome the last query
but now i have another problem
that is, i have to pass the value of <c:forEach> value to custom tag
this is my code:
Vector rs = (Vector)request.getAttribute("ROLESERVICES");


<c:forEach items="${SERVICES}" var="services">
<td class="rightsubheading1" colspan="2">
<aims:ex value='${services.serviceId}' object="<%=rs%>"/>
<td class="leftsubheading1" colspan="2"><cut value="${services.serviceName}"/></td>
when i print the value from tag handler class i am getting
but i wish to send the value..

let me know how to pass this value

warm regards

Thanks & Regards<br />Mallik Avula<br />SCJP1.4
Kamesh Rao
Ranch Hand

Joined: Dec 24, 2006
Posts: 35
Use org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager classes evaluate method as defined below

public static Object evaluate(String attributeName,
String expression,
Class expectedType,
Tag tag,
PageContext pageContext);
Hassan Ashmawy

Joined: Feb 14, 2007
Posts: 1
I have a problem like the problem of yours :-
// ALL_EMPS is a Vector of (EmpDTO) in the session
<c:forEach varStatus="status" var="EmpDTO" items="${sessionScope.ALL_EMPS}">
<td align="right" bgcolor="#ffffff">
Emp No. : <cut value='${status.index}' />
<cut value="${EmpDTO.FirstName}" />
<cut value="${EmpDTO}" />

1) when i use the first (c : out) i get the following error: An error occurred while evaluating custom action attribute "value" with value "${EmpDTO.FirstName}": Unable to find a value for "FirstName" in object of class "b2c.EmpDTO" using operator "." (null)
2) when i use the second (c : out) i get - ofcourse - something like that : b2c.EmpDTO@1854d1f which the the class name and the hash no. of the current that object!!!

any help expert-guys ??
Carol Enderlin
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Next time start your own post instead of resurrecting an old one.

<cut value="${EmpDTO.FirstName}" />

If your bean has getFirstName() and setFirstName(), then you should be using EmpDTO.firstName with lowercase f.
I agree. Here's the link: http://aspose.com/file-tools
subject: passing c:forEach value to custom tag as attribute?
It's not a secret anymore!