| Author |
getting variable value
|
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
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
Joined: Jan 01, 2009
Posts: 874
|
|
What c:out is for ?
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
this is my jsp .But it don't print any value
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
[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.
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
then how .
please tell me.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
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.
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
${sessionScope.userLevel} is working
but <c ut value="userLevel" default='guest' /> gives nothing
whta happen ?
|
 |
Shailesh Narkhede
Ranch Hand
Joined: Jul 10, 2008
Posts: 356
|
|
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,
|
Thanks,
Shailesh
|
 |
Shailesh Narkhede
Ranch Hand
Joined: Jul 10, 2008
Posts: 356
|
|
but <c  ut value="userLevel" default='guest' /> gives nothing
for this it is giving userLevel as output.
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
yes .
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
soory for the mistake
this prints userLevel
this prints Cowboyl
my queation how to print this value using c ut;
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Aruna,
What does <c ut value="${userLevel}" /> prints ?
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
I change my jsp to this.
then it give this
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
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.
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
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
Joined: Jan 10, 2002
Posts: 56554
|
|
|
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.
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
|
is it true that jstl 1.2 doesn't need standered.jar file?
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
now it is working.it gives output as
Cowboy
Cowboy
Cowboy
here is the code
|
 |
sameera liyanage
Ranch Hand
Joined: Nov 25, 2008
Posts: 692
|
|
Bear Bibeault ,Balu Sadhasivam
Thanks for helping
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
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.
|
 |
 |
|
|
subject: getting variable value
|
|
|