Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp and multiple users  RSS feed

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given in a jsp

if(res.getTicketStatus().equals("pending") ||res.getTicketStatus().equals("waiting list") || res.getTicketStatus(). equals("reserved")){ //do something}

where res is a bean in session scope, should I be worried about enhancing the above code with

String status=res.getTicketStatus();
1 2 3
if(status.equals("pending") ||status.equals("waiting list") ||status. equals("reserved")){ //do something}

In other words, is it possible for the value returned by res.getTicketStatus() to change between conditions checked in the if statement.( i.e. between 1 and 2 or 2 and 3)

I'm trying to enhance some code written by someone.
Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, if the value of that scoped variable can be changed by code running in a window "owned" by the same user (e.g. multiple browser instances, iframes, Ajax calls, or framesets).

You do not need to worry about code being run by other users in other sessions.
 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!