aspose file tools*
The moose likes Struts and the fly likes How to call struts plugin from action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to call struts plugin from action class?" Watch "How to call struts plugin from action class?" New topic
Author

How to call struts plugin from action class?

Rajitha Arun
Ranch Hand

Joined: Aug 24, 2006
Posts: 43
Hi,

My application uses struts plugin interface. When the app comes up it gets connected to DB2 and executes some query. We have downtime for these and everything gets restarted at the same time. If DB2 is not up at the right time then the app fails and it throws servlet exception, since it uses plugin class while it comes up and stores the respective data in the servlet context.

I need workaround solution for this. So I thought of checking the context for each request and if the attributes in the context are null I thought of calling the plugin class again. Is this a good idea? If so how will I call the struts plugin class from my struts action class.

Please HELP!

Thanks in advance


Rajitha
SCJP, SCWCD
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest you refactor. Put the code that does the initialization into a method in a separate utility class. Then call that method from both your plugin and your Action class.


Merrill
Consultant, Sima Solutions
Rajitha Arun
Ranch Hand

Joined: Aug 24, 2006
Posts: 43
Thanks Merrill. After while driving to office I was thinking the same thing. Once again thanks for letting me know that I am on the right direction.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call struts plugin from action class?