Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring Web应用程序-请求的资源不可用_Java_Jsp_Spring Mvc_Tomcat_Web - Fatal编程技术网

Java Spring Web应用程序-请求的资源不可用

Java Spring Web应用程序-请求的资源不可用,java,jsp,spring-mvc,tomcat,web,Java,Jsp,Spring Mvc,Tomcat,Web,我想问你一个关于SpringWeb应用程序的简单教程示例有什么问题 我正在尝试访问此URL上的网站: http://localhost:8084/SpringTutorial/hello 作为对这个URL的响应,我从ApacheTomcat服务器获得HTTP404——资源不可用 项目文件夹结构的图像位于本文的底部 代码如下: web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.1" xm

我想问你一个关于SpringWeb应用程序的简单教程示例有什么问题

我正在尝试访问此URL上的网站:

http://localhost:8084/SpringTutorial/hello
作为对这个URL的响应,我从ApacheTomcat服务器获得HTTP404——资源不可用

项目文件夹结构的图像位于本文的底部

代码如下:

web.xml

<?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
        <display-name>SpringTutorial</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/spring-dispatcher-servlet.xml</param-value>
            </init-param>

            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>spring-dispatcher</servlet-name>
            <url-pattern>/</url-pattern>
        </servlet-mapping>
    </web-app>
<?xml version='1.0' encoding='UTF-8' ?>
<!-- was: <?xml version="1.0" encoding="UTF-8"?> -->
<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">

    <!-- Scanning for anotation base classes (controllers) -->
    <context:component-scan base-package="com.controllers" /> 
    <!-- Using anotation based classes (controllers) -->
    <mvc:annotation-driven/>

    <bean id="viewResolver"
          class="org.springframeúwork.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp" />

</beans>
HelloPage.jsp
显示
消息
属性。 简单的HTML代码如下:

<html>
   <head>
   ...
   </head
   <body>
     <h2>${message}</h2>
   </body>
</html>

...

你能把你的项目文件发布到结构上吗?还有HelloPage?@mosheard的代码,我刚刚上传了HTML基本代码,它只在HelloPage.jsp中显示属性“message”。项目结构的图像位于文章的底部。感谢您更改请求方法以进入RequestMapping@JackFlamp这也无济于事。
<html>
   <head>
   ...
   </head
   <body>
     <h2>${message}</h2>
   </body>
</html>