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 閱讀(117) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 沙河市| 紫云| 乐昌市| 利辛县| 迁安市| 盐池县| 商城县| 石柱| 清河县| 吐鲁番市| 公主岭市| 永嘉县| 城市| 灵台县| 宜春市| 繁峙县| 淳安县| 新营市| 江永县| 中宁县| 灵璧县| 麻江县| 法库县| 郧西县| 甘洛县| 马鞍山市| 石阡县| 白山市| 纳雍县| 平南县| 外汇| 涿州市| 棋牌| 迁安市| 阜康市| 钟祥市| 巴林右旗| 塘沽区| 天柱县| 东兴市| 大同县|