1.创建index.jsp页面。新建表单
注意: action 填写 input,这个之后再web.xml配置时要注意对应。 method 提交 postt
<body>
<form action="input" method = "post">
用户名:<input type = "text" name = "username" >
</br>
密码:<input type = "password" name = "mima">
<input type = "submit" value = "提交">
</form>
</body>
2.新建类InputServlet在nuc.ss.test下,和实验一步骤一样,不多重复
重写doGet方法
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//设置请求对象的编码格式
req.setCharacterEncoding("utf-8");
String username = req.getParameter("username");
String mima = req.getParameter("mima");
//