欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

jsp源码实例1(输出)

程序员文章站 2024-01-28 20:50:28
package coreservlets;import java.io.*;import javax.servlet.*;import javax.servlet.http.*;/...
package coreservlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

/** Simple servlet that generates HTML.
* <P>
* Taken from Core Servlets and JavaServer Pages
* from Prentice Hall and Sun Microsystems Press,
* https://www.coreservlets.com/.
* &copy; 2000 Marty Hall; may be freely used or adapted.
*/

public class HelloWWW2 extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 " +
"Transitional//EN"> ";
out.println(docType +
"<HTML> " +
"<HEAD><TITLE>Hello WWW</TITLE></HEAD> " +
"<BODY> " +
"<H1>Hello WWW</H1> " +
"</BODY></HTML>");
}
}