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
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2699
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 (Download ) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- 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
Saloon Keeper
Joined: Jul 29, 2008
Posts: 2699
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
posted Apr 18, 2010 10:29:36
0
Also, use Boolean.TRUE , and simplify the conditional to ${session["check"]} . As mentioned previously.
subject: how to get sessionscope boolean varible