| Author |
How to invoke struts action through a simple java class
|
ajch Chawla
Greenhorn
Joined: Jan 10, 2005
Posts: 7
|
|
Hi All, I need to invoke some struts action through a simple java/servlet which is running as a seperate thread in my application. Any solutions? Ajay
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
|
Forward the request/response to the Action using the same RequestDispatcher#forward(request, response) method you would use for regular servlets.
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Jitesh Sinha
Ranch Hand
Joined: Jun 19, 2004
Posts: 144
|
|
If you only want to call Action class,it should not be difficult. Just need to load that particular action class by a classloader and execute the execute/perform method depending on whatever version of struts you are using... This is identical to what RequestProcessor class does within struts framework...
|
 |
Jitesh Sinha
Ranch Hand
Joined: Jun 19, 2004
Posts: 144
|
|
|
Lasse,I doubt he will have access to RequestProcessor class
|
 |
ajch Chawla
Greenhorn
Joined: Jan 10, 2005
Posts: 7
|
|
yeh. thanks. Now the problem is how do I run a servlet as a deamon thread.
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
Originally posted by ajch Chawla: Now the problem is how do I run a servlet as a deamon thread.
You don't. What you can do is to have your servlet start a new, separate daemon thread.
|
 |
 |
|
|
subject: How to invoke struts action through a simple java class
|
|
|