Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Collaboration between Struts Actions and plain old Servlets

 
author
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?
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • 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
 
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
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
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...
 
This is my favorite tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic