Forums Register Login

can't 2 users access the same jsp page at time

+Pie Number of slices to send: Send
i have a jsp page which is written for retreving the data from the data base now this program works very fine when one user usses it but when more users use it giving the same criteria for retrevial then it shows no data found exception. my database is in sql server does it got to do anything with it. kindly tell me what to do.
+Pie Number of slices to send: Send
Each request for a jsp or servlet is served by separate threads. Where do you have the code? In jsp or servlet ? Do you use instance vars/static vars ? Because they are shared by other requests also (unless you implement the 'SingleThreadModel' Servlet).
Please post the code snippet so that we understand more clearly.
regds
maha anna
+Pie Number of slices to send: Send
the code is written in jsp and i also have instance variables i dont think i will be able to past the code its almost 600 lines and each bit of it contrubits to the output can u let me know how would i b able to implement singlethreadmodel.
+Pie Number of slices to send: Send
I am in middle of another work. Off of my mind this comes up. If I am not wrong, there is a 'isThreadSafe=false' attribure in <@ page ...> directive . please check the jsp tag reference and make isThreadsafe=false and give it a try. It may make the performance slow though.
regds
maha anna
+Pie Number of slices to send: Send
but still the same even after implementing " isThreadSafe="false" " is theis any other alternative to this. kindly help
+Pie Number of slices to send: Send
Did you create the database connection(s), statement(s) and resultset(s) in a <%! ... %> block?
If so, do this elsewhere. Everything in such a block is static (and can thus be modified by only one instance at a time.
Another possibility is that your database will not accept more connections than the number created by a single request.
+Pie Number of slices to send: Send
<%!
DBHandlerdbHandle;
ResultSetrs;
StringsearchString, searchType;
StringreportType, sqlString;
VectorindexWords, srchWords;
VectorfileNames; //field to store the file names.
HashtablestoreReports, storeDates;
Connectionconn;
PreparedStatementpstmt;
Stringroot, queryString;
booleanYesNo;
intsize,temp1=0;
intj,sri,my1;
int temp2=10;
intindexno = 0;
String getstring1,getstring2,getstring4;
java.util.Date getdate1;
String color,textcolor;
int mydisplay1;
//clossing the decleration
%>
this is waht i have between my <%! .. %> tags i dont think any where i have created any connection or statement or resultset only i have declared them here kindly let me know what could b the remedy for the second option u have given.
+Pie Number of slices to send: Send
Although you don't create the connection in the class body, you do store it there, which can cause confusion between multiple threads. Try moving all your database-related variables into the request-handler part of your JSP. For example
+Pie Number of slices to send: Send
hi
i have changed the code as u have suggested, now sometimes it is showing some internal server error 500 and i am unable to decode where the error is present, sometimes it is showing the result of some other request on the whole the prg has become unconistent , suggest me what to do now
expecting a responce
all this is only when 2 users access the same prg at the same time
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 822 times.
Similar Threads
Check username availability in JSP - Any ideas?
data mixup for two responses
Personalized URL with Struts
Q about JSP (1): use of Vector in JSP
use diffrent servlet values (how to unload a servlet)
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:26:58.