0

Tomcat 7 でプロジェクトを実行すると、404 エラーが発生します。

春のセキュリティ:

<beans xmlns:p="http://www.springframework.org/schema/p"
    xmlns:security="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
    xsi:schemalocation="http://www.springframework.org/schema/beans  
                           http://www.springframework.org/schema/beans/spring-beans.xsd  
                           http://www.springframework.org/schema/security  
                           http://www.springframework.org/schema/security/spring-security-3.1.xsd">
    <!-- <beans:import resource="Employee-servlet.xml"/> -->

    <security:http use-expressions="true">
        <intercept-url pattern="/Springhib/index.jsp/" access="permitAll" />

        <intercept-url pattern="/Springhib/jsp/login.jsp"
            access="permitAll" />
        <form-login login-page="login.jsp" default-target-url="/welcome.jsp"
            authentication-failure-url="/error.jsp" />
        <logout invalidate-session="true" logout-url="/logout.jsp" />
    </security:http>

    <security:authentication-manager>
        <security:authentication-provider>
            <jdbc-user-service data-source-ref="dataSource"
                users-by-username-query="select username,password enabled from userlogin where username= ?" />
        </security:authentication-provider>
    </security:authentication-manager>

</beans>

Employee-servlet.xml : データソース (MySQL)、休止状態のトランザクション マネージャー (休止状態の構成)、および internalviewresolver が含まれています。

web.xml:

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    version="3.0">
    <display-name>SprinHib</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>

    </welcome-file-list>
    <servlet>
        <servlet-name>Employee</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>
        <servlet-name>Employee</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/Employee-servlet.xml,
        /WEB-INF/spring-security.xml
        </param-value>

    </context-param>
    <session-config>
        <session-timeout>10</session-timeout>
    </session-config>

    <!--spring security -->
    <filter>

        <filter-name>springSecurityFilterChain</filter-name>

        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

    </filter>

    <filter-mapping>

        <filter-name>springSecurityFilterChain</filter-name>

        <url-pattern>/**</url-pattern>

    </filter-mapping>

</web-app>

プロジェクト構造

ここに画像の説明を入力

インデックス ページからログイン ページにリダイレクトし、同時にコントローラーで次のページでさらに使用するために Bean (POJO/モデル) をインスタンス化します。ログインに成功すると、ユーザーがウェルカム ページに移動します。

編集: Index.jsp:

<c:redirect url="login"/> 

autoredirect のみが含まれます。

stackoverflow で以前のソリューションを検索しましたが、問題は解決しませんでした。

どんな助けでも大歓迎です。

4

0 に答える 0