This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Servlet called more than once Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet called more than once" Watch "Servlet called more than once" New topic
Author

Servlet called more than once

Srividya Shiv
Ranch Hand

Joined: Jul 20, 2000
Posts: 31
Hi
I have this strange problem. I noticed this in my application :
When I submit my form, the servlet is being called many times(I checked this thru my logs). After 3 or 4 times, my session is killed and I am logged off the application. This doesnt happen always but sometimes. When I looked at some FAQs for a solution, there was a suggestion that I should not have a 'form action' and also a 'javascript submit' in the same JSP. I removed the cation attribute from form tag , but my problem hasnt been solved. Can anybody give me some idea as to why this happens and what i can do to solve it?
Thanks
srividya
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

where is the javascript (i mean on what event)? If it's possible, post some of your code (the HTML that contains your form and javascript)
Srividya Shiv
Ranch Hand

Joined: Jul 20, 2000
Posts: 31
My page looks like this(Its too lengthy,so I edited it):
<script>
function submitButton(sValuex) {
doSubmit(sValuex, 'home');
}
function doSubmit(valuex, formName) {
evaluate('var Form= document.'+formName);
evaluate('Form.mode.value = valuex');
Form.submit();
</script>

<form name="home" method ="POST">
------some code---------
<a href="javascript:submitButton(1000)"><img src="/jsp/images/btn_users.gif" border="0"></a>

<input type="hidden" name="mode" value="0">
</form>
Srividya Shiv
Ranch Hand

Joined: Jul 20, 2000
Posts: 31
I had to use evaluate insted of eval, because otherwise I cannot post it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet called more than once
 
Similar Threads
HTML +Javascript submit query??
When is validate called on a DynaValidatorForm?
Calling a web service in a java servlet,.. servlet not finding jar files from axis
Servlet Mapping
callflow glassfish V3