This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes how to get sessionscope boolean varible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to get sessionscope boolean varible " Watch "how to get sessionscope boolean varible " New topic
Author

how to get sessionscope boolean varible

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
this is my jsp


when i run it it prints otherwise alwayssssssssss.
why it is not printing trueeeeeeee.
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013
    
  35

Samanthi perera wrote:when i run it it prints otherwise alwayssssssssss.

Please UseRealWords.
And again again again, you should NOT place those Scriptlets in JSPs.


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
Try this:



set your attribute in the servlet, not in the jsp.

Bye,
Nicola
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
ya .it is working.thanks .
anyway why otherway is not working.
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
Because it's not the right way to access sessionScope object where your check variable resides.

Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013
    
  35

Samanthi perera wrote:why otherway is not working.

In EL, anything you placed within the square-brackets in considered as an expression.
In particular, it works if you placed "check" as a String value: ${sessionScope["check"]}
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Also, use Boolean.TRUE, and simplify the conditional to ${session["check"]}. As mentioned previously.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get sessionscope boolean varible
 
Similar Threads
How can I call servlet from jsp without using form
Best choice for pagination?
JSP Error page driving me nuts
how to avoid show buttons
Number of Table Rows Returning Double