• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Action executed two times

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!

I am having a strange problem. When I click a link in my webpage the action attached to that click is called twice instead of just once... Then, when the action is finished for the 2nd time, it goes where the action forward says. The action works perfectly but it does it two times which is a big problem since the action consist of writing in a database (it writes the same two times ). Anyone knows what could be happening?

Thanks
 
Ranch Hand
Posts: 258
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please send the code. Have you used html:submit and also submitting the form through javascript.
 
Ranch Hand
Posts: 479
1
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

On a project one of my team mates faced something of the same sort. Each form had a simple button which would invoke a javascript function call and the function would submit the form based on the status of the form validation. Later this button was changed to a submit button and the same situation arose. Debugging revealed that the form was getting submitted twice. Once with the html submit button. And the next time with the javascript form.submit() call.

I felt it was worth a metion as you could probably have a similar situation. For any more thoughts you ought to post more detail...

Cheers,
Raj.
 
Mnau Lubi
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


When I click in Join, the action /join is called two times
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://struts.apache.org/1.2.x/userGuide/struts-html.html#button

If you're not inside a form, don't use Struts 1 form tags.

May not solve the problem, but it's still incorrect.
 
Mnau Lubi
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:http://struts.apache.org/1.2.x/userGuide/struts-html.html#button

If you're not inside a form, don't use Struts 1 form tags.

May not solve the problem, but it's still incorrect.



Yes that was the problem. However I liked how it looked like when it was with buttons, is it any alternative you can suggest to me?

Thanks
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just use an HTML button w/o the Struts tag?
 
What? What, what, what? What what tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic