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 阅读(105) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: