• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forwarding to a servlet instead of a jsp

 
dnyan ginde
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
dnyan ginde
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a ton Merrill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic