• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Methods executing twice

 
Abhishek Asthana
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am facing a strange problem. In my struts based application, certain methods are being executed twice. In some of these methods I am doing database transactions and those transactions are also being done twice.
Has anyone faced this problem?
Please tell me what can be done to avoid this problem.
Thanks,
Abhishek.
 
Franck Tranchant
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

If your action methods , including database access etc.. are executed twice, you can be 99% sure that your actions are actually called twice.
Incorrect use of javascript could explain that kind of behaviour.

Don't you have some javascript coded in your JSP's on events like onclick/onsubmit/image+href.. ?
If so, double-check the 'return' value to avoid your Form being posted twice.
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
follow up to franck's comment. the most common problem is using html:submit (or input type submit) along with a javascript submit, instead of html:button (or input type button).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic