程序手記

          程序是我畢生的追求......
          隨筆 - 19, 文章 - 0, 評論 - 9, 引用 - 0
          數(shù)據(jù)加載中……

          JAVA WEB開發(fā) (First Servlet Samlet Code) 第四天

          HelloServlet.java

          package tw.com.javaworld.CH2;

          import javax.servlet.*;
          import javax.servlet.http.*;
          import java.io.*;

          public class HelloServlet extends HttpServlet{
              //Initialize global variables
              public void init(ServletConfig config) throws ServletException{
                  super.init(config);
              }
              
              //Process the HTTP Get request
              public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
                  response.setContentType("text/html;charset=GB2312");
                  PrintWrite out = response.getWrite();
                  out.println("<html>");
                  out.println("<body>");
                  out.println("Hello World<br>");
                  out.println("大家好");
                  out.println("</body>");
                  out.println("</html>");
                  out.close();
              }

              //Get Servlet information
              public String getServletInfo(){
                  return "tw.com.javaworld.CH2.HelloServlet Information";
              }
          }

          posted on 2008-08-04 18:15 程序手記 閱讀(240) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 贡嘎县| 芜湖县| 浑源县| 丰城市| 津市市| 沅江市| 比如县| 青河县| 昆山市| 上蔡县| 康保县| 元朗区| 临汾市| 红桥区| 鄂尔多斯市| 龙岩市| 桦甸市| 峨山| 申扎县| 新宁县| 玉山县| 汾阳市| 双峰县| 莆田市| 深州市| 惠东县| 芜湖县| 建水县| 杭州市| 临洮县| 襄樊市| 马边| 和龙市| 江永县| 兰州市| 肃北| 新巴尔虎右旗| 临漳县| 昌黎县| 灵寿县| 柳林县|