melody

          成為最優秀的自己
          數據加載中……
          MyServlet.java

          import java.io.*;
          import java.util.*;
          public class MyServlet extends HttpServlet{
           private String target="/hello.jsp";
            public  void init (ServletConfig config)throws ServletException
             {super.init(config);}

            public void doGet(HttpServletRequest request,HttpServletResponse response)
            throws ServleException ,IOException
           { doPost(request,response); }

           public void doPost(HttpServletRequest request,HttpServletResponse response)
            throws ServleException ,IOException{
           
           String username =request.getParameter("username");
           String password =request.getParameter("password");

           request.setAttribute("USER",username);
           request.setAttribute("PASSWORD",password);

           ServletContext context=getServletContext();
           System.out.println("Redirecting to"+target);
           RequestDispatcher myservlet=context.getRequestDispatcher(target);
          myservlet.forward(request,response);
          }
          public void destroy(){};

          }

          posted on 2008-03-18 17:34 meilody 閱讀(116) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 淳化县| 惠来县| 芮城县| 富川| 黑河市| 石楼县| 武隆县| 台山市| 长岛县| 简阳市| 茶陵县| 钦州市| 万年县| 平顶山市| 济阳县| 伊宁县| 辽源市| 葵青区| 繁昌县| 巴彦县| 竹山县| 边坝县| 松桃| 迁安市| 英超| 临安市| 大竹县| 涿州市| 天水市| 大田县| 齐齐哈尔市| 克山县| 凉城县| 彭阳县| 敦煌市| 乐平市| 虎林市| 柳江县| 北宁市| 监利县| 伊通|