aspose file tools*
The moose likes JSP and the fly likes getting variable value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "getting variable value" Watch "getting variable value" New topic
Author

getting variable value

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
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 ?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
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.
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
then how .
please tell me.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Nov 25, 2008
Posts: 1225
${sessionScope.userLevel} is working
but <cut value="userLevel" default='guest' /> gives nothing
whta happen ?
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
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: 368
but <cut value="userLevel" default='guest' /> gives nothing


for this it is giving userLevel as output.

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
yes .
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
soory for the mistake

this prints userLevel


this prints Cowboyl


my queation how to print this value using cut;
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


Aruna,

What does <cut value="${userLevel}" /> prints ?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
I change my jsp to this.



then it give this
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

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

Joined: Nov 25, 2008
Posts: 1225
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: 61766
    
  67

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

Joined: Nov 25, 2008
Posts: 1225
is it true that jstl 1.2 doesn't need standered.jar file?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
now it is working.it gives output as
Cowboy
Cowboy
Cowboy

here is the code

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1225
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting variable value