File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Forward from Servlet to Action class?" Watch "Forward from Servlet to Action class?" New topic
Author

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

harry
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30085
    
149

Harry,
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
 
 
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