ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  JSP Standard Tag Libraries, Part 1
Subject:   How to refer java variable inside tag
Date:   2008-11-14 05:09:10
From:   arulman
Hi,
I want to refer java variable or anyutility method inside jstl tag,


For example, please see the below code.I want to refer baseURL java varibale value inside tag iteration.



<!-- include core JSTL taglibs -->
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>


<!-- make sure EL is enabled for this page -->
<%@ page isELIgnored="false" %>
<%@ page import="java.util.*" %>
<%@ page import="com.jpmorgan.corea.cow.bean.*" %>
<%
String baseURL = "http://localhost:8080/test";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<body>
<c:forEach var="test" items="${TestAccounts}">
<c:out value="${test.accountID}"/>
<c:out value="<a href=${baseURL}/TestControllerServlet?command=${test.accountName}>${test.accountName}"/>
</c:forEach>
</body>
</html>


Thanks
Arul