MVC controller is being called twice

后端 未结 16 660
无人及你
无人及你 2020-11-27 05:15

I have a controller that is being called twice from an ActionLink call.

My home page has a link, that when clicked calls the Index method on the Play controller. An

16条回答
  •  萌比男神i
    2020-11-27 05:40

    10 hours chasing that bug in a Java Spring Maven project.

    First on SELECT I thought Hibernate was just logging twice, but then with INSERT I thought requests were called twice. Stepping throught the code I discovered controller was called twice...

    Tried all possible Spring configuration, thinking the context was loaded twice or a bean was instantiate twice...

    In despair, rebuilded the project piece by piece to finally add a fragment of HTML and kaboom bug's back.

    
    

    The sharp sign was guilty, reloading the URL. I know the topic is old, but I summarized my searchs with the words I used to look for in vain on Internet to find an answer to the same issue! Could help others...

提交回复
热议问题