Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
378
Chapter 15 Integrating Servlets and JSP
Listing 15.10 ShowPage.java 
package coreservlets;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/** Example of the include method of RequestDispatcher.
 *  Given a URI on the same system as this servlet, the
 *  servlet shows you its raw HTML output. 
 */
public class ShowPage extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String url = request.getParameter("url");
    out.println(ServletUtilities.headWithTitle(url) +
                "\n" +
                "

" + url + "

\n" +
                "
\n" +
                "\n" +
                "\n" +
                "");
  }
  /** Handle GET and POST identically. */
  public void doPost(HttpServletRequest request,
                     HttpServletResponse response)
      throws ServletException, IOException {
    doGet(request, response);
  }
}
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved