controller注解配置路径 form中的action怎么配置 10
controller:@Controller@RequestMapping("/loginuser")publicclassLoginUserController{@Re...
controller:
@Controller
@RequestMapping("/loginuser")
public class LoginUserController {
@Resource
private LoginUserServiceImpl LoginUserServiceImpl;
@RequestMapping(value="/login", method=RequestMethod.POST)
public String login(@RequestParam("loginName") String loginName,
@RequestParam("password") String password,
Model model, HttpSession session){...}
jsp:
<form action="/store/loginuser/login" method="post">
<SPAN>姓名:</SPAN><input name="userName" type="text"/>
<SPAN>密码:</SPAN><input name="password" type="password"/>
<input type="submit" value="登录" />
</form>
报错404:
HTTP Status 404 - /store/loginuser/login 展开
@Controller
@RequestMapping("/loginuser")
public class LoginUserController {
@Resource
private LoginUserServiceImpl LoginUserServiceImpl;
@RequestMapping(value="/login", method=RequestMethod.POST)
public String login(@RequestParam("loginName") String loginName,
@RequestParam("password") String password,
Model model, HttpSession session){...}
jsp:
<form action="/store/loginuser/login" method="post">
<SPAN>姓名:</SPAN><input name="userName" type="text"/>
<SPAN>密码:</SPAN><input name="password" type="password"/>
<input type="submit" value="登录" />
</form>
报错404:
HTTP Status 404 - /store/loginuser/login 展开
2个回答
2017-11-22
展开全部
<form action="<c:url value='/store/loginuser/login'>" method="post">
该方法需要再、在页面定义 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<form action="<%=basePath%>/store/loginuser/login" method="post">
该方法需要在页面定义 basePath,新建JSP里面就有,不贴代码了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询