• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

c:out,c:set

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please clarify:

1)If
<c:out value='${user}'/>
Here what is the scope in which the container finds user? Does it use findAtttribute() to check in page scope first then request,session and then application?
or how?
2)<c:set var="${user}" value="pink" scope="session"/>

This will look for the variable 'only' in the session scope,if there is an attribute by name'user' it will fetch its value .


Without specifying scope:
<c:set var="${user}" value="pink" />
Now does it by default check 'user' in all scopes? If it does not find in page scope,are the rest of the scopes checked?

<c:set var="${user} value="" />
Now will it remove the attribute from all the scopes? or only from the scope in which it first encounters this variable?

<c:remove var="user" />
This will remove user from all the scopes.
whereas <c:remove var="user" scope="request"/>
This will remove user from only request scope.

Please validate these cases if my understanding is wrong.
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Yes all cases are right. The order of search is page,request,session,application..
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Just a quick correction on 2)

<c:set var="${user}" value="pink" scope="session"/>

would cause the following exceptioin:
org.apache.jasper.JasperException: /Test.jsp(33,0) According to TLD or attribute directive in tag file, attribute var does not accept any expressions

The reason it that var attribute is declared with: <rtexprvalue>false</rtexprvalue>
and it doesn't accept scripting expressions or EL expressions.

Thanks
Katrin
 
He's my best friend. Not yours. Mine. You can have this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic