Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting variable value

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i can set the varible value using
<c:set var=”userLevel” scope=”session” value=”Cowboy” />

but how to get the value of userLevel?
I tried
${sessionscope.userLevel}
${userLevel}

but all are not working
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What c:out is for ?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my jsp .But it don't print any value

 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[quote]<c:out value='userLevel' default='guest' /> [/quote]

This is not right. How do you print EL in c:out ? Its pretty much the same way.
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then how .
please tell me.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aruna sameera wrote:
${sessionscope.userLevel}
${userLevel}

Case counts. It's sessionScope.

The other should have worked. What are you seeing in the rendered HTML?

P.S. <c:out> is not necessary unless you want the output HTML-encoded.
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${sessionScope.userLevel} is working
but <cut value="userLevel" default='guest' /> gives nothing
whta happen ?
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes ,
I also tried.
AppView.jsp


for only ${sessionScope.userLevel} it is working.
when I try to do for above jsp it thowing following exception,



 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but <cut value="userLevel" default='guest' /> gives nothing


for this it is giving userLevel as output.

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes .
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
soory for the mistake

this prints userLevel


this prints Cowboyl


my queation how to print this value using cut;
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Aruna,

What does <cut value="${userLevel}" /> prints ?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I change my jsp to this.



then it give this
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That usually means that you are mixing versions that are not compatible. What versions of JSP, and the JSTL are you using?

P.S. You are using a JSTL 1.0 URI.
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is that mean?
how could i find which version of JSTL i am using ?
what are the limitation of that?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read through the JSP FAQ. If you don't even know what versions of software you are using, you need to buckle down and figure all that out.
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it true that jstl 1.2 doesn't need standered.jar file?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now it is working.it gives output as
Cowboy
Cowboy
Cowboy

here is the code

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault ,Balu Sadhasivam
Thanks for helping
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aruna sameera wrote:is it true that jstl 1.2 doesn't need standered.jar file?


Yes if you download and see the files inside the jstl 1.2 jar , it contains tag handlers as well as tld files all inside single jar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic