aspose file tools*
The moose likes Struts and the fly likes Multiple calls to struts2 action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple calls to struts2 action" Watch "Multiple calls to struts2 action" New topic
Author

Multiple calls to struts2 action

kooper Sivan
Greenhorn

Joined: Jul 01, 2011
Posts: 16

Hi,

My project uses struts2 with spring and Jpa on Hibernate.
On debugging the application i've seen that the action class is being invoked twice.
Am unable to figure out why this occurs.
Is it something to do with the transaction?
Any suggestions on why this is happening.

Thanks,
Kooper
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

whatever the frameworks you integrate with struts 2 action class never execute twice until and unless you redirect to the same action again.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
kooper Sivan
Greenhorn

Joined: Jul 01, 2011
Posts: 16
Hi Mohan,

Thanks for your reply.
Could you please elaborate more on this.
I was unable to understand what exactly you meant by redirecting to the same action class..

Thanks,
Kooper
kooper Sivan
Greenhorn

Joined: Jul 01, 2011
Posts: 16
And how do i prevent redirection to the same action class..
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

post your struts.xml configuration file. For your reference follow the link http://struts.apache.org/2.0.11/docs/redirect-action-result.html
kooper Sivan
Greenhorn

Joined: Jul 01, 2011
Posts: 16

sure please find below


the above action is invoked when a link is clicked for the first time to load the page "manageUsers.jsp" with values from DB.
the action which returns JSON has been commented for the timebeing.



the above method is invoked by the action, the subsequent methods within populate data at runtime, but the the method is getting invoked twice, even after the processing is over the first time.



 
Don't get me started about those stupid light bulbs.
 
subject: Multiple calls to struts2 action