This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

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

let me know how to pass this value

warm regards
Mallik


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
Greenhorn

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}">
<tr>
<td align="right" bgcolor="#ffffff">
Emp No. : <cut value='${status.index}' />
<cut value="${EmpDTO.FirstName}" />
<cut value="${EmpDTO}" />
</td>
</tr>
</c:forEach>

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
drifter
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?
 
Similar Threads
Error Occurred When Using JSP Expression Inside Struts c:forEach Tag
JSTL c:forEach help?
Struts Error Message
JSTL List Help
use c:forEach tag inside another c:forEach tag