I have the file spring-security.xml configured as follow:
<http auto-config="true">
<intercept-url pattern="/welcome*" access="ROLE_ADMIN" />
<form-login login-page="/login" default-target-url="/welcome"
authentication-failure-url="/loginfailed" />
<logout logout-success-url="/logout" />
</http>
dispatch-servlet.xml as follow
<context:component-scan base-package="springmvc.web" />
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:default-servlet-handler />
<!-- Declare a view resolver -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/views/" p:suffix=".jsp" />
so accessing through the URL ../myapp/welcome or ../myapp/login I get an 405, and there is a login.jsp under /WEB-INF/view/login.jsp
Thanks
Here /login
and /welcome
are expected to be controller(@Controller annotated classes) methods annotated with appropriate @RequestMapping
.
One workaround, if all your controller does is to return the view name may be to do the following:
<mvc:view-controller path="/login" view-name="login"/>
<mvc:view-controller path="/welcome" view-name="welcome"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.