Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet called more than once

 
Srividya Shiv
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had to use evaluate insted of eval, because otherwise I cannot post it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic