私は、残りのWebアプリケーションにSpringとAngularJSを使用しています。 thisチュートリアルのベースと私は、次のフォルダ構造を作成したthisチュートリアルに基づいて:私は、次のようなリソースを宣言したように、静的なHTMLファイルを提供したい名前がYのサーブレットで名前Xのビューを解決できませんでした。
-src
|----main
|----webapp
|----static
|----api
|----assets
|----resources
|----sections
|----services
|----index.html
|----WEB-INF
|----web.xml
|----spring
|----dispatcher-servlet.xml
|----applicationContext.xml
を:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<mvc:annotation-driven></mvc:annotation-driven>
<context:component-scan base-package="org.tools.mvc.controllers"></context:component-scan>
<mvc:resources location="/static/" mapping="/**"/>
<mvc:resources location="/static/api/" mapping="/api/**"/>
<mvc:resources location="/static/assets/" mapping="/assets/**"/>
<mvc:resources location="/static/resources/" mapping="/resources/**"/>
<mvc:resources location="/static/services/" mapping="/services/**"/>
<mvc:resources location="/static/sections/home/" mapping="/sections/home/**"/>
<bean name="viewResolver" class="org.springframework.web.servlet.view.BeanNameViewResolver"></bean>
<bean name="jsonTemplate" class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"></bean>
私の問題は、Glassfishサーバーを使用しているアプリケーションをデプロイすると、Eclipseコンソールとブラウザのページで次のエラーが発生することです。
2016-05-27T04:46:06.640-0700|Warning: StandardWrapperValve[dispatcher]: Servlet.service() for servlet dispatcher threw exception
javax.servlet.ServletException: Could not resolve view with name 'index.html' in servlet with name 'dispatcher'
サービスの機能には影響ありません(Postmanを使用して残りのAPIをテストすると成功します)。これまでは、アプリケーションをさらに開発するために、URLの最後に手動でindex.htmlを追加しました(localhost:8080/status/index.htmlなど)。ソースWeb配置総会で宣言されているように "/" である:
出典:/ srcに/メイン/ webappの
展開パス:/
更新:web.xmlファイルを探しています
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>status</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
どのように私はこのエラーを解決することができます。このような?
は
はSO私のシナリオに適用されていなかったで見つかったソリューションをP.Sありがとうございます。