2011-10-27 9 views
3

私たちは、「/ *」のURLパターンを持っており、要求が私たちのコントローラに着くが、我々は常にここで404 を取得するには、私たちのweb.xml春/ * URLパターン

<servlet> 
    <servlet-name>bro</servlet-name> 
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
    <init-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>classpath:mo/config/mo-spring.xml</param-value> 
    </init-param> 
    <load-on-startup>1</load-on-startup> 
</servlet> 
<servlet-mapping> 
    <servlet-name>bro</servlet-name> 
    <url-pattern>/*</url-pattern> 
</servlet-mapping> 

カ月であります-spring.xml:

<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="suffix" value=".jsp"/> 
</bean> 

<mvc:resources mapping="/css/**" location="/css/" /> 
<mvc:resources mapping="/images/**" location="/images/" /> 
<mvc:resources mapping="/js/**" location="/js/" /> 
<mvc:resources mapping="/views/" location="/views/" /> 

コントローラのビット:

@RequestMapping(value="/signon", method=RequestMethod.GET) 
public String signon(HttpServletRequest request) { 
      ... 
    return "/WEB-INF/index"; 
} 

web.xmlのurl-patternとして/ xxx/*を使用すると、すべてが期待通りに機能しますが、私たちが実際に変更したくないdojoアプリケーションがあります。これは/ *と/ xxx/*

答えて

2

*それは問題ではない場合は、server.xml

であなたのURLマッピングのためのサーブレット名としてサーブレット名として仲間が、参照BRIOを持っていて、http://yourserver/に対応するためにアプリを望んで話していますhttp://yourserver/yourcontext/ *の代わりにwebappをサーバーのルートwebappとして展開する必要があります。ここではTomcatの構成のようなものに関連する質問ですTomcat 6: How to change the ROOT application

編集:私のコメントからコピー - あなたのWebアプリケーションのルートするのDispatcherServletをマッピングしている場合は、http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#mvc-default-servlet-handler

+0

Iに記載されたデフォルト・サーブレット構成が必要になりますあなたが誤解していると思う、私はyourcontextで見つけましたが、私が望むものはweb.xmlにあります。私はを/ and not/springとして参照しています。 – arinte

+0

大丈夫ですが、http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#mvc-default-servlet-handler – digitaljoel

関連する問題