File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes jsp and java bean problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp and java bean problem" Watch "jsp and java bean problem" New topic

jsp and java bean problem

shashank bezalwar

Joined: Oct 31, 2007
Posts: 17
i have a jsp page to display information about various projects created by users. each user is able to see the projects created by him. i am using java bean to store the information of projects for particular user. but sometimes i get project information of other user and when i refresh the page i get my project details, can anyone please tell me what is the problem.
Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Hi Shashank bezalwar ,

From the very brief information provided by you i think you should look at
the query which is bringing the information about a particular user in your jsp.
If you want to discuss it more please tell how are you bringing values in your jsp from the back end.

Ben Souther

Joined: Dec 11, 2004
Posts: 13410

As Khushwinder Chahal said, we need more details before we could give you any specific information.

Two things to look for:
Are you using instance variables in your servlets or JSPs?
Did you bind your bean to context (application) scope instead of session or request scope?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
shashank bezalwar

Joined: Oct 31, 2007
Posts: 17
i am using the bean in session scope.

this is the query i am using to fetch the project details:

sqlQuery = "SELECT * FROM projectgroups WHERE projectgroups.status ='In Progress' AND projectgroups.userId =userId;

here is my code for returning the information to the jsp

i am passing the arraylist to jsp page where i retrieve the information from arraylist.
shashank bezalwar

Joined: Oct 31, 2007
Posts: 17
i am storing the user id in session variable, but when i get the information of other users the user id is correct but the values are of different user.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Is the arraylist an instance variable? If so, that's probably the problem.

So much trouble in the world -- Bob Marley
shashank bezalwar

Joined: Oct 31, 2007
Posts: 17
yes my arraylist is instance variable, could you please explain me what is the problem here.
I agree. Here's the link:
subject: jsp and java bean problem
It's not a secret anymore!