permaculture playing cards*
The moose likes JSP and the fly likes Using JSTL/EL to access page variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Using JSTL/EL to access page variable" Watch "Using JSTL/EL to access page variable" New topic
Author

Using JSTL/EL to access page variable

Steve J Holmes
Greenhorn

Joined: Feb 08, 2008
Posts: 4
I know that EL is working (2.4 DTD on weblogic 9.2) as ${pageContext.request.requestURI} is rendering correctly, but I'm having difficulty declaring a variable in the page and referencing it later on, specifically:

<%
boolean myBoolean = true;
%>

...

<cut value="${pageScope.myBoolean}" />

I've got jstl-1.1.jar and standard-1.1.jar deployed in my WEB-INF/lib

Thanks in advance
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Your variable needs to be bound to one of the scope objects (like request) before it can be accessed from EL.

Why are you trying to mix the two?
[ February 08, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Indeed. The JSTL and EL, meant to eradicate scriptlets, are purposefully designed to not interact with scripting variables.

pageScope does not address scripting variables, but scoped variables placed into page scope.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using JSTL/EL to access page variable