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

jsp源码实例1(输出)

程序员文章站 2024-02-26 16:14:58
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,
* 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>");
}
}