File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get sessionscope boolean varible

 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my jsp


when i run it it prints otherwise alwayssssssssss.
why it is not printing trueeeeeeee.
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4116
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:



set your attribute in the servlet, not in the jsp.
 
Samanthi perera
Ranch Hand
Posts: 510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya .it is working.thanks .
anyway why otherway is not working.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because it's not the right way to access sessionScope object where your check variable resides.

 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4116
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, use Boolean.TRUE, and simplify the conditional to ${session["check"]}. As mentioned previously.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic