aspose file tools*
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
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: 3174
    
  47

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.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
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: 3174
    
  47

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get sessionscope boolean varible