This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes threadsafety in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "threadsafety in JSP" Watch "threadsafety in JSP" New topic

threadsafety in JSP

Abhi Jh

Joined: Sep 12, 2002
Posts: 8
I am using a class which returns an Arraylist in a jsp.
I was wondering if it will be threadsafe or not - since I was not very sure if the particular arraylist shows up as an instance variable or a method variable in the jsp instance..
code in the jsp:
dataCommand = new GetIdeasByOfferNamesValueOfferName );
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
Although your question and code example are not very detailed, you will not have threading issues in a JSP as every variable (declared in scriplet) is method local.
Also, if you are saying "new", every thread will be creating a new instance, and is inherently thread-safe.
I agree. Here's the link:
subject: threadsafety in JSP
It's not a secret anymore!