Spring 在Tomcat中调用index.html

Spring 在Tomcat中调用index.html,spring,apache,http,spring-mvc,tomcat,Spring,Apache,Http,Spring Mvc,Tomcat,我正在尝试用Tomcat运行一个应用程序。我创建了一个生成war文件的应用程序,我将该文件放在Tomcat上运行该应用程序,但当我尝试运行该应用程序时 这给了我一个错误: HTTP Status 404 - type Status report message description The requested resource is not available. Apache Tomcat/8.0.28 更详细的信息: 06-Nov-2015 16:35:07.052 WARNIN

我正在尝试用Tomcat运行一个应用程序。我创建了一个生成war文件的应用程序,我将该文件放在Tomcat上运行该应用程序,但当我尝试运行该应用程序时

这给了我一个错误:

HTTP Status 404 -

type Status report

message

description The requested resource is not available.

Apache Tomcat/8.0.28
更详细的信息:

06-Nov-2015 16:35:07.052 WARNING [http-nio-8080-exec-51] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/AppletTest/] in DispatcherServlet with name 'mvc-dispatcher'
在tomcat的dir安装中,我的应用程序位于

~/apache-tomcat-8.0.28/webapps/

并且
index.html
和其他文件位于

~/apache-tomcat-8.0.28/webapps/AppletTest/WEB-INF/pages/index.html

我犯了什么错误

我的文件:

web.xml

<?xml version="1.0" encoding="UTF-8"?>

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


    <servlet>
        <servlet-name>spring-dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>mvc-dispatcher</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <load-on-startup></load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>mvc-dispatcher</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/mvc-dispatcher-servlet.xml</param-value>
    </context-param>

</web-app>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:component-scan base-package="com.something.controller" />
    <bean
            class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/WEB-INF/pages/</value>
        </property>
        <property name="suffix">
            <value>.html</value>
        </property>
    </bean>

</beans>

您已经创建了一个Spring应用程序。 在Web.xml上,您已将所有请求(/*)映射到SpringServlet

现在,您必须创建一个控制器来侦听您的URL

例如:

@Controller
public class IndexController {

    @RequestMapping(value = "", method=RequestMethod.GET)
    public String index(Model m)  {
        return "index/index";
    }

}

现在,此方法将侦听{context}/url并返回index.html视图。

我尝试了此方法,但不起作用:(我必须简单地调用localhost:8080/AppletTest-right?你有/WEB-INF/pages/index/index.html文件吗?现在有什么错误吗?我尝试放置/WEB-INF/pages/index.html我需要索引文件夹?因为你没有放置索引文件夹,所以让你的控制器返回“index”;嗯,很难找到缺少的内容。请在github上共享您的项目,以便我们可以查看