简体   繁体   中英

The struts actions called twice

I'm using struts 1.1 and my strut actions are called twice every time I made a single request. I don't have submit button in the jsp page. Form submission is done by jquery. Is it because of my computer ?

Any kind help is appreciated.

Use a tool like Firebug (Firefox extension) or Live Http Headers and check the HTTP requests the browser is sending to the server. There may be some javascript or meta-refresh tags somewhere generating multiple requests to the same resource?

EDIT: Also check, there is a possibility of looping due to misconfigured redirects/forwards in your JSP/action eg page1 -> page2 -> page1.

I was facing the same problem a while a go. But I've figured it out that in my web.xml I had:

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
        org.apache.struts.action.ActionServlet
    </servlet-class>
    <load-on-startup>2</load-on-startup>
  </servlet>

Load on startup element was set to 2:

<load-on-startup>2</load-on-startup>

So I've made it to be set to 1:

<load-on-startup>1</load-on-startup>

And it solved my problem. Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM