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

Collaboration between Struts Actions and plain old Servlets

 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure whether this will help
http://www.jguru.com/faq/view.jsp?EID=471961
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Pradeep. I believe that was exactly what I was looking for!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic