Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
SpringMVC不工作_Spring_Spring Mvc - Fatal编程技术网

SpringMVC不工作

SpringMVC不工作,spring,spring-mvc,Spring,Spring Mvc,我尝试使用SpringMVC创建一个示例项目 详情如下。 当我在服务器上运行时,我得到httpstatus:500错误 org/springframework/beans/factory/Aware 请帮忙 web.xml <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xs

我尝试使用SpringMVC创建一个示例项目 详情如下。 当我在服务器上运行时,我得到httpstatus:500错误 org/springframework/beans/factory/Aware

请帮忙

web.xml

<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>Spring web application</display-name>

<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

</web-app>
我拥有的jar文件是

commons-logging-1.1.3.jar
org.springframework.asm-3.0.3.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.core-sources-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework.web.servlet-sources-3.0.3.RELEASE.jar
org.springframework.web-3.0.0.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.1.1.RELEASE (1).jar
spring-web.jar
spring-webmvc-3.1.1.RELEASE.jar
jsp文件hello.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"      "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SpringApp</title>
</head>
<body>
<h1>Hello World</h1>
<p>${message}</p>

</body>
</html>

我在网上搜索。我找不到任何答案。请帮助使此代码正常工作。谢谢

您正在混合Spring的各种版本:3.0.3、3.0.5、3.0.0、3.1.1。这是一个非常糟糕的主意。顺便说一句,所有这些版本现在都很旧了。你为什么不使用最新的版本呢?你能指定我可以从中获取所有jar文件的链接吗?我试过了,但是org.springframework.xyz jar不在zip文件中??您最好使用一个处理依赖关系管理的构建工具。单独下载每个jar,以及每个jar的每个正确依赖项,是一项乏味且容易出错的任务。最好使用gradle或Maven。罐子在Maven回购协议中:。最新版本为4.0.4-RELEASE。
commons-logging-1.1.3.jar
org.springframework.asm-3.0.3.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.core-sources-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework.web.servlet-sources-3.0.3.RELEASE.jar
org.springframework.web-3.0.0.RELEASE.jar
spring-beans-3.0.5.RELEASE.jar
spring-context-3.1.1.RELEASE (1).jar
spring-web.jar
spring-webmvc-3.1.1.RELEASE.jar
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"      "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SpringApp</title>
</head>
<body>
<h1>Hello World</h1>
<p>${message}</p>

</body>
</html>