我决定问这个问题,因为找不到任何答案帮助我解决这个问题。我尝试运行我的应用程序(tomcat与add.jsp文件),我正在
JasperException: The absolute uri: [http://www.springframework.org/tags/form] cannot be resolved in either web.xml or the jar files deployed with this application.
我一直试图解决这个问题大约一周而且我的想法用完了,所以我会很高兴找到任何线索。
我合作:
IntelliJ IDEA 2018.1.3(终极版)
JRE:1.8.0_152-release-1136-b38 amd64
Apache的Tomcat的9.0.8
的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>movie</artifactId>
<groupId>com.moviedatabase</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>movie-webapp</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.moviedatabase</groupId>
<artifactId>movie-application</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.9.Final</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
的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>Baza filmów</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</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/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
add.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ 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=UTF-8">
<title>Dodaj film</title>
</head>
<body>
<a href="list.jsp">Powrót do listy filmów</a><br />
<form:form method="POST" modelAttribute="movieDto">
<table border="1">
<tbody>
<tr>
<th>Tytuł</th>
<td><form:input type="text" path="title"/><c:if test="${pageContext.request.method=='POST'}"><form:errors
path="title"/></c:if></td>
</tr>
<tr>
<th>Autor</th>
<td><form:input type="text" path="author"/><c:if test="${pageContext.request.method=='POST'}"><form:errors
path="author"/></c:if></td>
</tr>
<tr>
<th>Rok wydania</th>
<td><form:input type="text" path="year"/><c:if test="${pageContext.request.method=='POST'}"><form:errors
path="year"/></c:if></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Dodaj!" /></td>
</tr>
</tbody>
</table>
</form:form>
<br />
<hr />
</body>
</html>
HTTP状态500 - 内部服务器错误
类型例外报告
消息绝对uri:[http://www.springframework.org/tags/form]无法在web.xml或使用此应用程序部署的jar文件中解析
描述服务器遇到意外情况,导致无法完成请求。
异常
org.apache.jasper.JasperException:绝对uri:[http://www.springframework.org/tags/form]无法在web.xml或使用此应用程序部署的jar文件中解析 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:294) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:81) org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:251) org.apache.jasper.compiler.TagLibraryInfoImpl。(TagLibraryInfoImpl.java:122) org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:489) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1445) org.apache.jasper.compiler.Parser.parse(Parser.java:144) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244) org.apache.jasper.compiler.ParserController.parse(ParserController.java:105) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206) org.apache.jasper.compiler.Compiler.compile(Compiler.java:385) org.apache.jasper.compiler.Compiler.compile(Compiler.java:362) org.apache.jasper.compiler.Compiler.compile(Compiler.java:346) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
注意服务器日志中提供了根本原因的完整堆栈跟踪。 Apache Tomcat / 9.0.8