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 forwarding to a servlet instead of a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "forwarding to a servlet instead of a jsp" Watch "forwarding to a servlet instead of a jsp" New topic
Author

forwarding to a servlet instead of a jsp

dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
Hello,

I want to forward to a servlet instead of a jsp from my action class. In my action class i retrieve the pdf from database as byte[]and then i want to forward to a servlet which displays this pdf. I dont want to use ForwardAction because i dont want the database code in the servlet. How can i forward to a servlet instead of a jsp from my action class? What are the changes i need to make?
[ February 22, 2006: Message edited by: dnyan ginde ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
To forward to a Servlet, just create a local forward that specifies the URL of your servlet and then return that ActionForward from the execute() method in your Action class.

example:
web.xml


struts-config.xml


execute() method in MyAction class:

return mapping.findForward("success");
[ February 22, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
dnyan ginde
Ranch Hand

Joined: Jan 17, 2006
Posts: 68
Thanks a ton Merrill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forwarding to a servlet instead of a jsp