2012-01-27 16 views
0

次の状況:Spring Roo 1.1(Apache Tiles & Spring MVC)を使用してWebアプリケーションを開発しています。私は各エンティティがパス(/ admin/users、/ admin/roles、...)によって到達可能な管理セクションを持っていたいと思っています。Spring MVC静的ページ

これまでのところすべてうまくいきました。唯一の問題は、/ adminに静的なページを置いておきたいということです。

<mvc:view-controller path="/admin" view-name="admin/index" /> 

また、ディレクトリ内のWEB-INF /ビュー/管理/ views.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd"> 
<tiles-definitions> 
    <definition extends="default" name="admin/index"> 
     <put-attribute name="body" value="/WEB-INF/views/admin/index.jspx"/> 
    </definition> 
</tiles-definitions> 
私はwebmvc-config.xmlに追加した独自のコントローラを作成したくないので、

私はindex.jspxを作成することも忘れませんでした。 web.xmlファイルの

内容:/管理を要求するときに

<display-name>reservation</display-name> 

<description>Roo generated reservation application</description> 


<!-- Enable escaping of form submission contents --> 
<context-param> 
    <param-name>defaultHtmlEscape</param-name> 
    <param-value>true</param-value> 
</context-param> 

<context-param> 
    <param-name>contextConfigLocation</param-name> 
    <param-value>classpath*:META-INF/spring/applicationContext*.xml</param-value> 
</context-param> 

<filter> 
    <filter-name>CharacterEncodingFilter</filter-name> 
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> 
    <init-param> 
     <param-name>encoding</param-name> 
     <param-value>UTF-8</param-value> 
    </init-param> 
    <init-param> 
     <param-name>forceEncoding</param-name> 
     <param-value>true</param-value> 
    </init-param> 
</filter> 



<filter> 
    <filter-name>HttpMethodFilter</filter-name> 
    <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class> 
</filter> 



<filter> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> 
</filter> 
<filter> 
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name> 
    <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class> 
</filter> 
<filter-mapping> 
    <filter-name>CharacterEncodingFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

<filter-mapping> 
    <filter-name>HttpMethodFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 



<filter-mapping> 
    <filter-name>springSecurityFilterChain</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 
<filter-mapping> 
    <filter-name>Spring OpenEntityManagerInViewFilter</filter-name> 
    <url-pattern>/*</url-pattern> 
</filter-mapping> 

<!-- Creates the Spring Container shared by all Servlets and Filters --> 
<listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
</listener> 

<!-- Handles Spring requests --> 
<servlet> 
    <servlet-name>reservation</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/spring/webmvc-config.xml</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
</servlet> 

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

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

<error-page> 
    <exception-type>java.lang.Exception</exception-type> 
    <location>/uncaughtException</location> 
</error-page> 

<error-page> 
    <error-code>404</error-code> 
    <location>/resourceNotFound</location> 
</error-page> 

は、残念ながら、私は、リソースが見つからないエラーが発生します。

誰かが私にそれについてのヒントを与えることができますか?

+0

他のページは正しくレンダリングされていますか? 1つの問題はあなたのビューリゾルバの設定かもしれませんが、他のページにアクセスできる場合は、私はそれを探しません。 –

+0

すべてが完全に機能しています。私は設定ファイルに触れなかった。 – rainerhahnekamp

+0

OK、これは非常に厳密に動作するようです。 "/ admin"のリクエストはうまくいっていますが、 "/ admin /"はうまくいきません。私の元の投稿では、私は "/ admin /"を要求していると言っていましたが、それは "/ admin /"だったので真実ではありませんでした... – rainerhahnekamp

答えて

0

<mvc:annotation-driven />がXML設定で定義されていることを確認してください。

+0

属性conversion-service = "applicationConversionService"で定義されています。 – rainerhahnekamp

関連する問題