File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes using an actionsupport class for spring Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Other Application Frameworks
Reply Bookmark "using an actionsupport class for spring" Watch "using an actionsupport class for spring" New topic
Author

using an actionsupport class for spring

Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
Hi Guys,

Sorry this is half Spring, half Struts, I hope this is a good spot. I've created a base action class that extends ActionSupport. Through this class the dataSource for my application is injected via Spring. The action classes used throughout my application extend this class, therefore gaining access to the dataSource. A question I have is each action class invoked for the first time will cause onInit() in the super class to be invoked, therefore five separate action classes are invoked, onInit() is invoked five times. I know Spring injects beans on a singleton basis, but this unnecessary calling on onInit(), is that a problem? Does anyone have a suggestion on getting a commonly used object such as a dataSource injected cleanly into a struts app? Thanks in advance...


SCJP 1.4 SCJD 1.5
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
There does not seem to be many people on this forum that are using Spring and Struts together. Your question seems to be more Spring related, so I would try a Spring related forum.

- Brent
Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
I agree, unfortunately I'm not able to move this myself and I hate to cross-post. Could one of the administrators move it?

- thanks.
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
I'm going to move this to the Application Frameworks forum.


Jason's Blog
 
 
subject: using an actionsupport class for spring
 
Threads others viewed
hibernate plz help me
Spring bean in strutsAction
Mark Spritzler: I never need to call getBean
getWebApplicationContext() w/ Struts
displaying data - reuse
IntelliJ Java IDE