为什么我用springmvc框架controller获取不到页面用户信息
jsp页面是这样写的:<fieldsetid="inputs"><inputid="username"name="${user.username}"type="text"...
jsp页面是这样写的:
<fieldset id="inputs">
<input id="username" name="${user.username}" type="text" placeholder="Username" autofocus required>
<input id="password" name="${user.password}" type="password" placeholder="Password" required>
</fieldset>
controller是这么写的
@RequestMapping("/LoginServlet")
public String validateUserInfo(@ModelAttribute("user") User user,
Model model) throws IOException
{
String name = user.username;
//这个name为空,也就是获取不到页面的输入的值
} 展开
<fieldset id="inputs">
<input id="username" name="${user.username}" type="text" placeholder="Username" autofocus required>
<input id="password" name="${user.password}" type="password" placeholder="Password" required>
</fieldset>
controller是这么写的
@RequestMapping("/LoginServlet")
public String validateUserInfo(@ModelAttribute("user") User user,
Model model) throws IOException
{
String name = user.username;
//这个name为空,也就是获取不到页面的输入的值
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询