Meaningless Drivel is fun!*
The moose likes Struts and the fly likes how to get variable of c:forEach  in a html:link tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to get variable of c:forEach  in a html:link tag" Watch "how to get variable of c:forEach  in a html:link tag" New topic
Author

how to get variable of c:forEach in a html:link tag

Ram Gokul
Ranch Hand

Joined: Oct 07, 2005
Posts: 85
I have follownig code where i am getting all rate codes in a <c:foreach Loop>
Inside the loop I want to contruct a <html:link tag > with primary key .
what is the best way to do this....

====

<c:forEach var="ratedetails" items="${rateDetailsArray}" >
<html:link page="/ViewRatecodes.do?ratecode='<c ut var='${ratecodes.ratecode}/>' ">
<bean:message key="link.AddressAction"/>
</html:link>
</c:forEach>

===
This is not working ..
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
First of all, you need to make sure you're using the html-el version of the tags. Your taglib definition should be:

<%@taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html" %>

and the struts-el.jar file needs to be in your WEB-INF/lib directory.

Then you can just use the EL expression without an enclosing <cut> tag:

<html:link page="/ViewRatecodes.do?ratecode='${rateDetails.ratecode}">
[ November 02, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get variable of c:forEach in a html:link tag
 
Similar Threads
Free instances held up by c:forEach tag
Complex Table and JSTL
passing a parameter to an action class
Iteration in structs
howto use JSTL foreach to display list ?