File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes session data mixed up problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "session data mixed up problem" Watch "session data mixed up problem" New topic
Author

session data mixed up problem

JW Li
Ranch Hand

Joined: Mar 11, 2003
Posts: 33
Hi,

I am working on a web application in JSP model 1, which includes another jsp file as html form with values from bean defined in the parent JSP file, and posts request back to parent JSP to process the request. This JSP page has session data mixed up problem and I could not find what's wrong in the code. (In fact, we couldn't reproduce this problem in our QA. The problem only occured when there are a lot of concurrent users.) The JSP does not have instance variables, and the majority code were got compiled in the service() method. It looks like this:
-------------

<%@ page session="true" />
<jsp:useBean id="data" scope="page" class="com.company.package..." />

<% .... JAVA code process the html form .... %>

<%@ include file="htmlForm.jsp" />

And in htmlForm.jsp:

<% some JAVA code that uses variables and beans defined in parent JSP %>
<!-- html form -->
<input type="text" name="field" value="<%= data.getName() %>" />

--------------
Can anyone help me to figure what's wrong on this code? We were using inclue tag to embed the html form in the parent JSP, is this the cause of the session data error? Should we use jsp:include instead? Or is there any other possible reason that the JSP is not thread safe? (Again, the JSP doesn't have any instance variables)!

Thanks very much for any help! I've run out of ideas on how to debug this problem!

[ October 19, 2004: Message edited by: JW Li ]

[ October 19, 2004: Message edited by: JW Li ]
[ October 20, 2004: Message edited by: Bear Bibeault ]
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
You're going to have to give more information here if you want some help.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I'm going to have to agree. At the moment the only thing we know for sure is that you have a problem. I still tend to think it's a thread safety problem, but there have been times when HTTP proxies have swapped user's session IDs, but this was a pretty extreme case.
JW Li
Ranch Hand

Joined: Mar 11, 2003
Posts: 33
Thanks for your input! It's very hard to get the related part of code posted, partly because the long trivial processing code, and partly because I don't know what's wrong. Anyway, here's the code, and thanks very much for your patience to help me debug... I am thinking maybe we should use jsp:include instead of include to embed the html form jsp since it contains dynamic data in it, which may cause thread safety problem...

The problem is that customer A gets customer B's notes:

-----------------------
customer.jsp:



-----------------------
Thanks again! Any input is highly appreciated!
[ October 20, 2004: Message edited by: JW Li ]

[ October 20, 2004: Message edited by: JW Li ]
[ October 20, 2004: Message edited by: JW Li ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: session data mixed up problem