使用UrlBasedViewResolver映射传入的UrlFilenameViewController(使用Spring安全性的登录页面)

时间:2010-12-23 15:08:45

标签: java spring spring-mvc spring-security

HTTP Status 404 - type Status report message description The requested resource () is not available.

我的应用程序使用spring security和tiles。我的security-config有以下

<form-login login-page="/onlinebasket/login.html"
      login-processing-url="/onlinebasket/loginProcess"
      default-target-url="/onlinebasket/index.html"
      always-use-default-target="true"
      authentication-failure-url="/onlinebasket/login.html?login_error=1" />
<logout logout-url="/onlinebasket/logout" logout-success-url="/onlinebasket/login.html" />

以下是我的servlet-config

<mvc:annotation-driven />

<!-- Simple redirects to internal resources; URL path substring becomes view name (e.g. '/login.htm' -> 'login') -->
<bean name="/login.htm" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
<bean name="/denied.htm" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>

<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basenames" value="/WEB-INF/messages/message,/WEB-INF/messages/validation" />
</bean>

<bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
    <property name="prefix" value="/WEB-INF/views/"/>
    <property name="suffix" value=".jsp"/>
</bean>

<bean id="tilesConfigurer" 
    class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" 
    p:definitions="/WEB-INF/defs/tiles.xml" />

<mvc:interceptors>
    <!-- Extends session for lazy loading on user requests -->
    <bean class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- Changes the locale when a 'locale' request parameter is sent; e.g. /?locale=de -->     
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />       
</mvc:interceptors>

最后,我的web.xml有以下servlet

<servlet-mapping>
    <servlet-name>onlinebasket</servlet-name>
    <url-pattern>/onlinebasket/*</url-pattern>
</servlet-mapping>

1 个答案:

答案 0 :(得分:0)

一个可能的问题可能是.html中的security-config.htm中的servlet-config