我的 spring mvc 应用程序使用以下 url
http://xyz.com/<war name>/springmvc/login
我已经更新了我的 web.xml
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/springmvc/*</url-pattern>
</filter-mapping>
我更新了spring security xml文件如下
<http access-decision-manager-ref="accessDecisionManager" auto-config="true">
<intercept-url pattern="/springmvc/welcome*" access="ADMIN" />
<form-login login-page="/springmvc/login" default-target-url="/springmvc/welcome"
authentication-failure-url="/springmvc/loginfailed" />
<logout logout-success-url="/springmvc/logout" />
<remember-me data-source-ref="dataSource"/>
</http>
如果我输入 springmvc/login 或 springmvc/welcome 它会进入登录页面。但是当我输入用户名和密码时,我得到一个 404。网址更改为http://xyz.com/UserInterface/springmvc/j_spring_security_check。我希望根据下面的控制器看到 hello.jsp
我的登录控制器如下
@RequestMapping(value="/welcome", method = RequestMethod.GET)
public String printWelcome(ModelMap model) {
User user = (User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
String name = user.getUsername();
model.addAttribute("username", name);
model.addAttribute("message", "Spring Security login + database example");
//logical view name
return "hello";
}