求教 Servlet
老是Servlet接收不到 ,老是出错,求大神指教一下。HTML部分:
<form action="UserServlet" method="post">
<div class="style1">用户名:<input type="text"width="150px" height="15px" id="user" name="userId"></div>
<div class="style1">密 码:
<input type="text"width="150px" height="15px" id="password" name="password"></div>
<div>
<input type="checkbox" id="save" />
<div> <input type="submit" value="登录" />
</form>
servlet 部分://名字是UserServlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
PrintWriter out=response.getWriter();
String userId = request.getParameter("userId");
String usePassword = request.getParameter("password");
//userDAO ud=new userDAO();
//ud.setUserInfo(userId, usePassword);
//System.out.println();
System.out.println(request.getParameter("userId"));
out.println(userId+usePassword);
out.flush();
}
}