• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Collaboration between Struts Actions and plain old Servlets

 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure whether this will help
http://www.jguru.com/faq/view.jsp?EID=471961
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Pradeep. I believe that was exactly what I was looking for!
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic