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.
I have a web application and will have users connected to it simmultaneous.
The problem is the next:
With Accept button go to Configuration Action class, and it makes a session.setattribute("configuration", config_object) for save some object into session, after it redirect to Generation Action class.
Generation Action class make a session.getattribute("configuration") for get the object saved in Configuration Action class, after it
Generation Action class make a session.setattribute("generation", generation_object), and session.setattribute("configuration", config_object_modified) after it redirect to the jsp.
In the jsp obtain the attributes with:
<jsp:useBean id="generation" scope="session" class="package.generationActionForm"></jsp:useBean>
<jsp:useBean id="configuration" scope="session" class="package.configurationActionForm"></jsp:useBean>
The problem is when two user acceded to click button I guess that the setattribute are saving like to application scope (getServlet().setattribute..) because both users the application display the same information and at the began the configuration was different. If the users acceded in different second the application run correctly.
If I synchronize the execute methods of Generation Action class and Configuration Action class the application runs correctly; but I dont want it, because if the user1 acceded to the database and his/her SQL Query runs slowly, the second user will be waiting until user1 finish.
If you're testing locally and attempting to simulate two users on a single machine then you might have a problem--different browsers handle the opening of new windows differently; some create a new session with the server, some don't. The best solution is to use two different browsers for two different users.
If two users on separate *machines* are getting the same session then something is very wrong with your server.