accessing a Java component in addition to dispatching requests and fetched data (from other components) to some JSP pages or other servlets. Forwarding Requests from Servlets In the recent past, the Java servlet programmer did not have a convenient way of implementing the preceding approach. But with the release of the Servlet API 2.1, the Java programmer can implement the RequestDispatcherinterface. Implementations of RequestDispatcher are available at ServiceContext and can be used to send a request to a static resource (an HTML page, for example) or a dynamic resource (a JSP or servlet, for example). The servlet programmer has two methods to implement: forward, to transfer control to another resource; or include, to handle the overall management of the request from, and the response to, the client. The code, shown in the following, forwards a request from a servlet to a JSP: //Assume request and response have their usual meaningRequestDispatcher rDisp = getServletContext().getRequestDispatcher(”myJSPPage.jsp”); rDisp.forward(request, response ) ; The URL argument in getRequestDispatcher is a relative path URL.
Our facility is located in Orlando, Florida. Our Orlando web hosting data center gives you assurance that your website will work smoothly . Check more in Orlando Web Hosting.