爱心技术专栏专题

实例1(输出)

摘录:JspServlet 来源:JspServlet 加入时间:2006年09月01日
摘要:
实例1(输出)

package coreservlets;

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

/** Simple servlet that generates HTML.
*  <P>
* &…

转载:转载请保留本信息,本文来自
http://www.51dibs.com
/html/2006/article/info20/a_63809e242d027341.htm

实例1(输出)

站点:爱心种子小博士 关键字:实例1(输出)

   
实例1(输出)
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,
*  http://www.coreservlets.com/.
*  © 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\">\n";
    out.println(docType +
                "<HTML>\n" +
                "<HEAD><TITLE>Hello WWW</TITLE></HEAD>\n" +
                "<BODY>\n" +
                "<H1>Hello WWW</H1>\n" +
                "</BODY></HTML>");
  }
}

客户服务中心信箱:[email protected] [email protected] 网站地图

声明

合作伙伴: