• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

jsp and multiple users  RSS feed

 
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.
 
Sheriff
Posts: 67259
170
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!