Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL jsp scope issue

 
Mauricio Lopes Bonetti
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mauricio Lopes Bonetti
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the generated Servlet:



Can't I get local objects using EL without specifying a scope?
 
Stefan Evans
Bartender
Posts: 1640
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic