Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke struts action through a simple java class

 
ajch Chawla
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forward the request/response to the Action using the same RequestDispatcher#forward(request, response) method you would use for regular servlets.
 
Jitesh Sinha
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lasse,I doubt he will have access to RequestProcessor class
 
ajch Chawla
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeh.
thanks.
Now the problem is how do I run a servlet as a deamon thread.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic