【问题标题】:springboot org.apache.jasper.JasperException Attribute invalid for tag according to TLDspringboot org.apache.jasper.JasperException 属性对根据 TLD 的标记无效
【发布时间】:2018-04-19 15:58:25
【问题描述】:

我一直在尝试将我现有的 Spring MVC 项目迁移到 Springboot,除了 org.apache.jasper.JasperException 一些 jsp 之前工作正常的异常之外,一切都很顺利 这是代码和异常

<form:input cssClass="form-control" id="serviceURL"
                                                    path="serviceURL" maxlength="250" value='${serviceProviderData.serviceURL}'
                                                    oninput="this.value=this.value.toLowerCase();"
                                                    onblur="this.value=this.value.trim();return validateserviceURL();"
                                                    onclick="clearErrorMsg('serviceURLErrDiv');" />

为此,根据 TLD,我得到 属性 [value] 对于标签 [input] 无效
这是我在jsp中包含的标签

<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

异常日志

2017-11-07 14:49:24.941 ERROR 6911 --- [nio-8092-exec-7] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/web] threw exception [/WEB-INF/pages/service.jsp (line: [168], column: [13]) Attribute [value] invalid for tag [input] according to TLD] with root cause

org.apache.jasper.JasperException: /WEB-INF/pages/service.jsp (line: [168], column: [13]) Attribute [value] invalid for tag [input] according to TLD

jsp渲染的依赖

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <!-- <scope>provided</scope> -->
        </dependency>

我不知道我在哪里做错了,因为之前使用 Spring MVC 也可以使用相同的 jsp

【问题讨论】:

    标签: java spring jsp tomcat spring-boot


    【解决方案1】:

    form:input 标签没有像 oninput 这样的属性。查看有效表单的完整列表:输入属性here

    【讨论】:

    • 我只有一个问题,为什么它在早期使用 spring MVC 但不能在 springboot 中工作,有什么办法可以忽略这些属性检查器?
    • 我不这么认为。从您编写的代码中,您可以使用form:inputonkeypress 属性,以便每次按下键时将值设为小写。或者您可以坚持使用纯 html 输入框作为 &lt;input type="text" oninput="myFunction()"&gt;
    【解决方案2】:

    根据springFORM TLD documentation,没有oninput定义

    I think you was using <form input=".." > as part of html not <form:input > as taglib.
    

    【讨论】:

      【解决方案3】:

      从 WEB-INF 位置删除 .tld 文件。

      【讨论】:

        猜你喜欢
        • 2014-06-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-08-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-24
        相关资源
        最近更新 更多