Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JSP and the fly likes Using JSTL/EL to access page variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply 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: 56166
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Using JSTL/EL to access page variable
 
Similar Threads
Attribute In Page Scope Doubt !!!
isScriptingEnabled dircetive problem
Problem with HFSJ EL exercise pg 366
Weird JSTL Behavior
JSTL and basic String methods