This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes EL jsp scope issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "EL jsp scope issue" Watch "EL jsp scope issue" New topic
Author

EL jsp scope issue

Mauricio Lopes Bonetti
Greenhorn

Joined: May 07, 2012
Posts: 2


That code should print "Sara". Am I wrong? It prints nothing.
"list" is in pageScope. EL should not look for it?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61105
    
  66

Mauricio Lopes Bonetti wrote:That code should print "Sara". Am I wrong?

You are wrong.

"list" is in pageScope.

It is not. Where did you place it into page scope?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mauricio Lopes Bonetti
Greenhorn

Joined: May 07, 2012
Posts: 2
That's the generated Servlet:



Can't I get local objects using EL without specifying a scope?
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
Declaring it as a local java variable on the page does not add it as an attribute in any scope.
If you want to access it in EL, you need to put it there explicitly.




And now of course to complete the example, you pull the scriptlet code out into a servlet where it belongs, and forward to the JSP.
 
Don't get me started about those stupid light bulbs.
 
subject: EL jsp scope issue