• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scriplet  RSS feed

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which scope does the variable declared inside the scriplet get created? page scope? can i access it inside any EL expression directly there after?
But this did not work for a map:

<% Map<String,String> mymap=new HashMap<String,String>();
mymap.put("5","val1");
%>
<c: out value='${mymap["5"]}' />

This did not show up anything
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65900
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
None.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65900
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, how would access the value in the map in a pojo?
Definitely not mymap["5"]... think more

The scope is synonymous to page scope.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65900
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Himanshu Kansal wrote:The scope is synonymous to page scope.

It is not. Scriptlet variables are not part of any EL scope. None. Nada. Zero.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reading my statement again for better understanding might help.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65900
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your statement says to me that you are claiming that creating scriptlet variables is synonymous with creating them in page scope. Which is, of course, not correct. If you meant something else, you will need to elaborate.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the scope of the variable created by:
<c:set...>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!