Hi, when submit event(Button) is called from a jsp Page, the control goes to the controller( Servlet), and there the service method is called twice.
My scenario is i am setting the hidden type field 'BEAN_COMMAND' in the form 'PRESENTATION', and when 'onSubmit', i am calling page LogController.java (Servlet). Here i am taking the parameter using getParameter("BEAN_COMMAND") in service method. But what happens is, first time i am getting a null, and next time i am getting the actual value.
I donot know y it is happening like this. Can u please clarify my problem.
And also in LogController.java, i used service method. String strCommand = req.getParameter("BEAN_COMMAND");
The service method is calling twice and this 'strCommand' value is getting null onetime, and the actual value in nexttime.
I have read one of the questions posted earlier, which saying that doGet method called twice when used .css file in 'href' tag. <link rel="stylesheet" type="text/css" href="<%=SERVER_CONTEXT%>web/css/<%=sCSS_TEMPLATE%>">
IS This could be any problem, please clarify my doubt....
Therefore your call to form.submit() in the onSubmit method submits the form for the first time and when your function returns, the browser is submitting the form for the second time. Hence doGet is being called twice.
Pete is right; for the code in <FORM name="myForm" onSubmit="return mySubmitFunc()"> to be executed the form must already be submitting, so calling myForm.submit() from within mySubmitFunc() is probably not what you want.
Joined: Aug 26, 2004
Thank u for responding,
And I havent found solution for the problem, and i observed one more thing that, the problem is not occuring when i use Mozilla Browser, i havent changed any of the code that u specified.
Can u please tell me what could be the problem,
Why IE6.0 is giving problem compared to Mozilla 1.6
Thank u with regards, Subrahmanyam.O
Joined: Aug 02, 2004
I don't mean to sound harsh, but the reason it works in Mozilla but doesn't work in IE is, in this case, irrelevant. It's not going to help you solve your problem. Your logic is submitting the form twice on each submit. If it works at all then it's a fluke.
I suggest you change the code as I suggested in my previous post and see if that works in IE. If it does, then test it in Mozilla. If it works in Mozilla too, then problem solved. If it doesn't work for some reason and you can't figure out why then please post again. IMHO there's nothing to be gained from spending time working out why dubious code behaves strangely.
subject: In Weblogic, service() being called twice