controller
@Controller
public class UserController {
@RequestMapping("/login.action")
public String login(String username, String password){
System.out.println(username);
System.out.println(password);
}
}
前台页面
<body>
<form action="${pageContext.request.contextPath}/login.action" method="post" >
<table>
<tr>
<td>用户名</td>
<td>
<input type="text" name="username" />
</td>
</tr>
<tr>
<td>密码</td>
<td>
<input type="password" name="password" />
</td>
</tr>
<tr>
<td><input type="submit" value="登陆"/></td>
</tr>
</table>
</form>
</body>
如上,后台接收到的username和password一直是null,是不是哪里漏写了什么?