jsp頁面======
用戶名Servlet頁面======
@WebServlet("/LoginServlet")
public class LoginServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name=request.getParameter("username");
System.out.println("servlet---"+name);
}
============================
用post能夠跳轉到servlet那,但是servlet裡面就算是System.out.println("servlet---");都不會輸出,。。。但是用get居然什麼都能輸出,這是為什麼?請大神們幫幫忙。。。
如果是Post方式提交,加上doPost方法。
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request,response);//這裡再調用doget
}