import java.io. * ; import javax.servlet. * ; import javax.servlet.http. * ; public class HelloWorld extends HttpServlet ... { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException ...{ try ...{ res.setContentType("text/html; charset=gb2312"); PrintWriter ōut = res.getWriter(); out.println("<html><head><title>我的测试</title></head><body>"); out.println("hello world"); out.println("<p><h1>你个小样!</h1></p>"); out.println("</body></html>"); out.close(); } catch (IOException e) ...{ //pass } }}