Author
How to redirect from servlet to JSP/Servlet with out executing the below code
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 05, 2010 23:04:52
Dear All
I'm using the servlet to upload the file.
The Feature of this Servlet is if it exceeds the size limit (ex:- 15Mb) it should redirect to Jsp/servlet so here im putting the condition of file size check if it is more than 15 mb it should redirect to another jsp or else it it should allow to upload
but im getting the size with in 2 second's but its not redirecting the servlet if it exceeds it ll take time around 20 minutes
So please give me hand on this issue
This message was edited 1 time. Last update was at Feb 06, 2010 00:56:19 by Bear Bibeault
Creativity is nothing but Breaking Rules
Deepak Bala
Bartender
Joined: Feb 24, 2006
Messages: 4871
posted Feb 05, 2010 23:29:01
Post the entire code. It is not possible to understand your logic unless you do that
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 05, 2010 23:34:40
Dear Deepak Bala
I ll give you the logic
here im redirecting to either one of the jsp file and even though it redirects its printing "hi dude" message .so my question is how to redirect it with out printing " hi dude" message
Creativity is nothing but Breaking Rules
Deepak Bala
Bartender
Joined: Feb 24, 2006
Messages: 4871
posted Feb 05, 2010 23:39:25
Please edit the code since some lines will surely not compile.
The redirect method is not a return statement. Lines of code after this statement will also be run by the JVM
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 05, 2010 23:47:10
The redirect method is not a return statement. Lines of code after this statement will also be run by the JVM
So how to avoid the JVM not to execute the code after redirect method
The code is compiling and running i think there is no error ....
Creativity is nothing but Breaking Rules
Deepak Bala
Bartender
Joined: Feb 24, 2006
Messages: 4871
posted Feb 06, 2010 00:06:24
So how to avoid the JVM not to execute the code after redirect method
Why do you want to do this ? Why do you have code after the redirect method ?
SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 06, 2010 00:27:55
Is there any solution or what ...?
or else i want to put it in if else block
Creativity is nothing but Breaking Rules
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 06, 2010 01:02:07
It is taking time in parsing the request
can we over come this ....
Creativity is nothing but Breaking Rules
David Newton
Author
Bartender
Joined: Sep 29, 2008
Messages: 6901
posted Feb 06, 2010 06:38:45
If you want to return after the redirect, use the "return" keyword.
Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 07, 2010 06:40:51
Dear David Newton
If you want to return after the redirect, use the "return" keyword.
Can you elobarate this statement
Creativity is nothing but Breaking Rules
David Newton
Author
Bartender
Joined: Sep 29, 2008
Messages: 6901
posted Feb 07, 2010 07:06:39
I suppose. In this code, doMoreStuff() will execute.In this code, it won't.That's about as elaborate as I can get, though.
Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
santhosh.R gowda
Ranch Hand
Joined: Apr 06, 2009
Messages: 265
posted Feb 07, 2010 21:24:39
Thanks David Newton
I understood the return word concept
But in my previous code
This statement is taking too much of time(3 minutes or more ) but when i execute the same code in my standalone application its taking few secongs(2) how to over come this problem
Creativity is nothing but Breaking Rules
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Messages: 2326
posted Feb 07, 2010 21:59:19
i dont know why this much time (3 mins) ? [may be network traffic]. showing a progressbar help you ?
ProgressBar
This message was edited 1 time. Last update was at Feb 07, 2010 22:01:13 by seetharaman venkatasamy
How to Ask Good Question |EL or JSTL problem |Tomcat Faq
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Messages: 519
posted Feb 08, 2010 09:28:44
Can't you check the content-length header of the request, and forward based on the size reported there?