gpt4 book ai didi

java - 简单 JSP - 根据 TLD,标签的属性无效

转载 作者:行者123 更新时间:2023-11-30 06:19:13 25 4
gpt4 key购买 nike

我在eclipse中的项目-

enter image description here

运行 MyTagUser.jsp 时出现以下错误 - HTTP Status 500 -/jsp/MyTagUser.jsp(14,0) Attribute subTitle invalid for tag Header according to TLD

org.apache.jasper.JasperException: /jsp/MyTagUser.jsp(14,0) Attribute subTitle 
invalid for tag Header according to TLD

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)...etc.

来自 Header.jsp 的片段 -

<body>
<img src="../images/java_logo.gif"><br>
<em><strong> ${subTitle} </strong></em> <br>
</body>

来自 MyTagUser.jsp 的片段 -

<%@ taglib prefix="myTags" tagdir="/WEB-INF/tags"%>
<html>
<head>
</head>
<body>
<myTags:Header subTitle="Java is the best !!!" />
JSP and Servlets.
</body>
</html>

最佳答案

您必须在 Header.tag 文件中使用属性指令,如下所示 -

<body>
<%@ attribute name="subTitle" required="true" rtexprvalue="true" %>
<img src="../images/java_logo.gif"><br>
<em><strong> ${subTitle} </strong></em> <br>
</body>

关于java - 简单 JSP - 根据 TLD,标签的属性无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23504719/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com