Friday, April 17, 2009

JSTL request attribute

The following is an example to set/get a request attribute using JSTL 1.1 and EL:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<c:set var="pageURI" value="tcm:1-2-3" scope="request"/>
PageURI1: <c:out value="${requestScope['pageURI']}"><br/>

<% request.setAttribute("a_b_c_pageURI", "tcm:4-5-6"); %>
PageURI2: ${a_b_c_pageURI}

No comments:

Post a Comment