• 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

The Action gets called twice in google chrome

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Google chrome when the jsp is submitted using <s:submit tag or <s:a tag the action gets called(executed) twice.

The same functionality works in IE 9 and Firefox 26 where the action is called only once.
PLease find the code below:



searchList.jsp


common-filter.xml(included in struts.xml)

CommonFilterAction.java


The filterSearchCommonList method is executed twice on click on submit/anchor button(id=submitFilter).

Please suggest .

Thanks.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch
I fixed your code tags. You should use a pair of code tags for each code sample so we can tell what file contains what. Also, you cannot do text formatting inside code tags, so I deleted those tags. If you need to point out a line, just use the line number.
I see you have JavaScript hooks on both the form and the submit button. Do either of those submit the form?
 
Shubhashree Udupa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for correcting me. I was not aware of it as i am using it for the first time .


The trimForm(this) and showProgressBar() do not submit the form. They are used to just trim the empty spaces in text field and show progress image on click of submit button.

I tried to submit the form through javascript and added an alert message in javascript method.



Observation: The filterSubmit() javascript method is called once i.e. alert message HI pops up only once.

But the action method filterSearchCommonList() is executed twice.(Only in chrome)
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shubhashree Udupa wrote:
Observation: The filterSubmit() javascript method is called once i.e. alert message HI pops up only once.

But the action method filterSearchCommonList() is executed twice.(Only in chrome)



This is correct behavior. The JavaScript method is submitting the form once and the submit button submits the form a second.
Get rid of the submit code in the JavaScript and return "false" from both JavaScript functions. This should prevent the JavaScript from submitting the form.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sometimes this also happens if you are loading an image which makes a request to server, then it goes through the same action method which was responsible to load the page
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic