Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble Forwarding  RSS feed

 
Prasanna Narayanan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
i have a servlet(Servlet01) in package A.
i need to forward the control to another servlet (Servlet02) in package B.
when i try this i doesnt work.
request.getRequestDispatcher("/Servlet02").forward(request,response);
nor this
request.getRequestDispatcher("/B/Servlet02").forward(request,response);
can any one help me plz.
note :in web.xml
<servlet>
<servlet-name>Servlet02</servlet-name>
<servlet-class>B.Servlet02</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Servlet02</servlet-name>
<url-pattern>/B/Servlet02</url-pattern>
</servlet-mapping>
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Servlet forum as this has nothing to do with JSF.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Common problem. You need to use getNamedDispatcher(...)

http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletContext.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!