aspose file tools*
The moose likes Struts and the fly likes Collaboration between Struts Actions and plain old Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Collaboration between Struts Actions and plain old Servlets" Watch "Collaboration between Struts Actions and plain old Servlets" New topic
Author

Collaboration between Struts Actions and plain old Servlets

Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hi all,

What would be the preferred way to combine the use of Struts Actions and regular Servlets inside a web application?

The situation is that I have a bunch of Struts Actions handling most of the web app but there's one Action I'd like to be doing something along these lines:

1) verify some user privileges (using a method in my abstract "BaseAction" class)
2) forward the request/response to a Servlet

Obviously I could just use RequestDispatcher#forward(request, response) but what should the Action's execute() method then return instead of an ActionForward instance as I usually do?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

I am not sure whether this will help
http://www.jguru.com/faq/view.jsp?EID=471961


Groovy
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by Lasse Koskela:

2) forward the request/response to a Servlet
Obviously I could just use RequestDispatcher#forward(request, response) but what should the Action's execute() method then return instead of an ActionForward instance as I usually do?


Yeah, do you see foresee problems doing a mapping.findForward('xyz') after you have done a RequestDispatcher#forward(request, response) to another servlet?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Thanks, Pradeep. I believe that was exactly what I was looking for!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by karthik Guru:
Yeah, do you see foresee problems doing a mapping.findForward('xyz') after you have done a RequestDispatcher#forward(request, response) to another servlet?
That was my worry but I'm quite optimistic that Pradeep's link is the cure...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collaboration between Struts Actions and plain old Servlets