KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > servlet > RequestDispatcher

javax.servlet
Interface RequestDispatcher

See Also:
Top Examples, Source Code, ServletContext.getRequestDispatcher(java.lang.String), ServletContext.getNamedDispatcher(java.lang.String), ServletRequest.getRequestDispatcher(java.lang.String)

public void forward(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    IOException
See Also:
IllegalStateException, ServletResponseWrapper, ServletRequestWrapper
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[118]Forward servlet
By Anonymous on 2004/08/24 01:54:05  Rate
public void doPost  ( HttpServletRequest req, HttpServletResponse res )  
       throws ServletException, IOException  {  
     HttpSession session = req.getSession ( false ) ; 
     if  ( session == null )   {  
       res.sendRedirect ( "http://localhost:8080/error.html" ) ; 
      }  
   
 ... 
  
  
      String url="/jsp/KickJava.jsp"; 
       ServletContext sc = getServletContext (  ) ; 
       RequestDispatcher rd = sc.getRequestDispatcher ( url ) ; 
       rd.forward ( req, res ) ; 
  }  


[1713]file download
By rembisz { at } gmail { dot } com on 2006/02/17 08:51:19  Rate
RequestDispatcher dispatcher = 
             getServletConfig (  ) .getServletContext (  ) .getRequestDispatcher ( "/"file_name ) ;         
         dispatcher.forward ( request, response ) ; 
  
  
 file_name has to be "aviable" by a servlet


public void include(ServletRequest request,
                    ServletResponse response)
             throws ServletException,
                    IOException
See Also:
ServletResponseWrapper, ServletRequestWrapper
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[386]Servlet which includes anther JSP in its reponse
By Jerry Gomes on 2005/08/05 11:16:06  Rate
// display the cart.jsp page 
     RequestDispatcher rd = getServletContext (  ) .getRequestDispatcher ( "/cart.jsp" ) ; 
     rd.include ( request, response ) ;

Popular Tags