GeeCON Prague 2014*
The moose likes JSP and the fly likes JSP page getting executed twice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "JSP page getting executed twice" Watch "JSP page getting executed twice" New topic
Author

JSP page getting executed twice

juanschodiger jha
Greenhorn

Joined: Mar 25, 2012
Posts: 8

I used 4 jsp pages in my application.When users selects some item on jsppage3 and clicks on go button then request will be redirected to jsppage4 but
everything on jsppage4 is getting executed twice.

Can you please let me know the reason why it is getting executed twice.I have all research on this topic still unanswered.

Neeraj Dhiman
Ranch Hand

Joined: Dec 19, 2011
Posts: 63

we can not say anything without seeing your jsp code.


Correct Me if i am wrong
Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125
juanschodiger jha wrote:
I used 4 jsp pages in my application.When users selects some item on jsppage3 and clicks on go button then request will be redirected to jsppage4 but
everything on jsppage4 is getting executed twice.

Can you please let me know the reason why it is getting executed twice.I have all research on this topic still unanswered.



Check whether the form submission from .."jsppage3" happens twice ??!!

For Quicker response, Please post your code
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
at a guess, it seems you have an <input type="submit"> which will submit the form when you click it.
You probably also have a javascript onclick event which will call form.submit().

Thus your form gets submitted (and thus processed) twice.

Standard resolutions
- in the onclick handler return false to indiciate you have handled the event
or
- make it a button type different from input type="submit"
 
GeeCON Prague 2014
 
subject: JSP page getting executed twice