有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

SpringMVCJava。lang.ClassNotFoundException:org。springframework。表示表达式分析器

我对春天完全陌生,不知道我在哪里犯了错误。我将spring 4.0.2 JAR与eclipse和tomcat一起使用

所有Jar文件:

spring-aop-4.0.2.RELEASE
spring-beans-4.0.2.RELEASE
spring-context-4.0.2.RELEASE
spring-context-support-4.0.2.RELEASE
spring-core-4.0.2.RELEASE
spring-jdbc-4.0.2.RELEASE
spring-jms-4.0.2.RELEASE
spring-orm-4.0.2.RELEASE
spring-test-4.0.2.RELEASE
spring-tx-4.0.2.RELEASE
spring-web-4.0.2.RELEASE
spring-webmvc-4.0.2.RELEASE
commons-logging-1.1.3

索引。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>Insert title here</title>
</head>
<body>
  <h2>Spring Home Page</h2>

  <form name="frmTravel" method="get" action="/SimpleSpringApp/travell">
    Travel Name : <input type="text" name="tvlName" />
    <input type="submit" value="Submit"/>
  </form>
</body>
</html>

成功。jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!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>Travel Success</title>
</head>
<body>
    <h2>Success Page</h2>
    <h3>Here need to show the message</h3>
</body>
</html>

网络。xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>SimpleSpringApp</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>


  <!-- ddf -->
  <servlet>
      <servlet-name>Travel</servlet-name>
      <servlet-class>
         org.springframework.web.servlet.DispatcherServlet
      </servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>

   <servlet-mapping>
      <servlet-name>Travel</servlet-name>
      <url-pattern>/</url-pattern>
   </servlet-mapping>

</web-app>

旅行社。xml:

<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.manoj.springprac" />

   <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="prefix" value="/WEB-INF/jsp/" />
      <property name="suffix" value=".jsp" />
   </bean>

</beans>

旅行。爪哇:

/**
 * 
 */
package com.manoj.springprac;

/**
 * @author Manoj
 *
 */
public class Travel {


    private String tvlName;

    public String getTvlName() {
        return tvlName;
    }

    public void setTvlName(String tvlName) {
        this.tvlName = tvlName;
    }


}

TravelController。爪哇:

package com.manoj.springprac;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class TravelController  {

    @RequestMapping(value = "/travell", method = RequestMethod.GET)
    public String printHello(ModelMap model) {
          model.addAttribute("message", "Hello Spring MVC Framework!");
          return "success";
       }

    //Here I want to save the data to database also

}

我真的不知道我在哪里错过了配置,以及spring 4.0中的SimpleFormController在哪里。x

任何建议都会有帮助


共 (2) 个答案

  1. # 1 楼答案

    在使用SpringBoot 2.0.0版本时,我在Console中遇到了同样的错误。我将Spring Boot Starter父版本更改为1.5.10版本。这对我很管用