package cn.rwkj.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class IndexServlet extends HttpServlet{ public void doGet(HttpServletRequest re,HttpServletResponse res) throws ServletException, IOException{ System.out.println("odget"); String name = re.getParameter("name"); String pwd = re.getParameter("pwd") ; System.out.println("name:" + name + " pwd: "+ pwd); //re.getRequestDispatcher("index.jsp").forward(re, res); res.sendRedirect("index.jsp"); } public void doPost(HttpServletRequest re,HttpServletResponse res){ System.out.println("odget"); } }
http://localhost:8080/rwkj1/indexServlet 跳 转 http://localhost:8080/rwkj1/index.jsp
时间: 2024-10-12 20:30:20