Java 从4到5版本的Spring MVC视图问题
在pom.xml以下依赖项中Java 从4到5版本的Spring MVC视图问题,java,spring,spring-mvc,pom.xml,Java,Spring,Spring Mvc,Pom.xml,在pom.xml以下依赖项中 <properties> <springframework.version>5.0.5.RELEASE</springframework.version> <!--<springframework.version>4.3.20.RELEASE</springframework.version>--> </properties> <dependencies>
<properties>
<springframework.version>5.0.5.RELEASE</springframework.version>
<!--<springframework.version>4.3.20.RELEASE</springframework.version>-->
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Servlet+JSP+JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- jsr303 validation -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
</dependencies>
还包括*.jsp文件中的第一行
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
...
...
您可以在中找到完整的项目,您可以找到答案
您使用属性commandName
,这是无法编译jsp的原因之一:
<form:form method="POST" commandName="customer"
您可以找到答案
您使用属性commandName
,这是无法编译jsp的原因之一:
<form:form method="POST" commandName="customer"
更改为modelAttribute有帮助。非常感谢你!更改为modelAttribute会有所帮助。非常感谢你!