package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class ServletSample extends GenericServlet {
public void service(ServletRequest request,ServletResponse response){
throws ServletException,IOException {
response.setCharacterEncoding("gbk");
PrintWriter out=response.getWriter();
out.println("<html>");
out.println("head");
out.println("<title>简单的例子</title>");
out.print("</head>");
out.println("<body>");
out.println("<center>");
out.println("<h2>这是第一个servlet的例子</h2>");
out.println("</center>");
out.print("</body>");
out.println("</html>");
out.close();
}
}
}
帮帮忙,我是初学者,请多多指教,谢谢
多了一组大括号