servlet编译出错

来源:百度知道 编辑:UC知道 时间:2024/06/03 02:45:50
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class SimpleServlet extends HttpServlet
{
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getwriter();
out.println("<html><head></head><body>");
out.println("<h1 align=center><b><i><font size=5 face=ArialBlack>"+"The first Servet,So simple!</h1></font></i></b></br>");
otu.println("<h2 align=center>you can see that this output is from the SimpleServlet.</h2>");
out.println("</body></html>");
out.close();
}
public void doGet(HttpservletRequest req,HttpservletResponse res)throws ServletException,IOException{

基本没什么语法错误,只不过有点小细节可能LZ没有注意到。
//导入的包注意!!!
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SimpleServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet
{
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException,IOException
{
res.setContentType("text/html");
PrintWriter out=res.getWriter();
out.println("<html><head></head><body>");
out.println("<h1 align=center><b><i><font size=5 face=ArialBlack>"+"The first Servet,So simple!</h1></font></i></b></br>");
out.println("<h2 align=center>you can see that this output is from the SimpleServlet.<