Two Laptop Bag*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 30136

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
It is sorta covered in the JavaRanch Style Guide.
subject: Forward from Servlet to Action class?
Similar Threads
how to call servlet from struts application
request dispatcher forward to struts 2 action
why do we need Application Controller?
get blank page for "Struts IN Action" first example ?
Struts + Applet issue