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>");
}
}
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>");
}
}
上一篇: WebSocket实现Web聊天室功能