@requestMapping url 重復(fù)的問題
@Controller ?
@RequestMapping("/user")
public class UserController {
??? @RequestMapping("/newUser")
??? public String newUser(){
?? ??? ?
?? ??? ?return "newUser";
??? }
}
jsp 頁面代碼是
<form action="user/newUser" method="post">
用戶名:<input type="text" name="userName" /> <br/>
密碼: <input type="text" name="password" /> <br/>
<input type="submit" value="創(chuàng)建">
返回到的url是 /user/user/newUser?
類映射重復(fù),各位大神知道這是什么原因嗎
2020-03-03
<form action="user/newUser" method="post">在action的地址前面加個 /? 就好了
<form action="/user/newUser" method="post">
2017-08-31
action="user/newUser" ?這里url給上絕對路徑就好了,如:action="<%=request.getContextPath()%>/user/newUser"
2017-03-14
百度一下看看,我也是剛剛學(xué)的,不是很懂呢。