betweenGo

Get JSTL Vars from PageContext

by on May.04, 2009, under JSTL

JSTL sets its vars in the pageContext.  For example:

pageContext.setAttribute("foo", bar);


Therefore to get a JSTL variable use the pageContext within a tag or a JSP page.  For example:

// get item from pageContext and put in request
atg.servlet.DynamoHttpServletRequest drequest = atg.servlet.ServletUtil.getDynamoRequest(request);
drequest.setParameter("foo", pageContext.getAttribute("foo"));


Note that getAttribute assumes the variable is in the page scope.  If you want to get a variable from for example the request scope you would do this.

pageContext.getAttribute("foo", javax.servlet.PageContext.REQUEST_SCOPE);


For further reading please see PageContext.


Share

Related posts:

  1. JSTL for current URI
  2. Accessing RepositoryItems with JSTL
  3. JSP Dynamo Request Retrieval
  4. Testing Which Page Loaded your JSP Page Fragment
  5. Getting the request parameter

:, ,

Leave a Reply

 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!