File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Forward from Servlet to Action class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Forward from Servlet to Action class?" Watch "Forward from Servlet to Action class?" New topic

Forward from Servlet to Action class?

A Harry
Ranch Hand

Joined: Jan 23, 2002
Posts: 124
I have to use a Servlet as part of my struts application.

is it possible to forward to a struts action class preserving the session object etc...?

Any sample code would be appreciated!

Many thanks

Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 29247

Yes. How to do that depends on what you are trying to accomplish.

If you want to just call the action class and get the results in the request/session, you can instantiate it and call the execute() method.

If you want to call the action class and the JSP it forwards to, you can have the servlet forward to the path the action uses in the struts config file.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Forward from Servlet to Action class?
Similar Threads
Struts + Applet issue
why do we need Application Controller?
how to call servlet from struts application
request dispatcher forward to struts 2 action
get blank page for "Struts IN Action" first example ?