... 我不断得到 test.jsp:6: expected `>' at ``$'' (for tag `' at line 6). The XML tag syn-6ren">
gpt4 book ai didi

jsp - JSTL 自定义标签变量替换

转载 作者:行者123 更新时间:2023-12-05 08:10:15 24 4
gpt4 key购买 nike

我在这里做错了什么:

<custom:tag param="<c:out value="${param.val}"/>" >
...
</custom:tag>

我不断得到

test.jsp:6: expected `>' at ``$'' (for tag `<custom:tag>' at line 6).  The XML tag syntax is: <tag attr1='value1'>

但这很好:

<a href="<c:out value="${param.val}"/>">link</a>

显然我想避免

<custom:tag param="<%= request.getParameter("val") %>" />

在没有 c:out 的情况下执行此操作也不起作用,我的 jSTL 不知道 <%@ page isELIgnored ="false" %>

摘自顶级域名

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>...</short-name>
<uri>...</uri>

<tag>
<name>...</name>
<tag-class>...</tag-class>
<description>...</description>
<attribute>
<name>attr1</name>
<required>true</required>
</attribute>
<attribute>
<name>param</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

最佳答案

嘿,你为什么要添加

<c:out value="${param.val}"/>

参数

<custom:tag param="<c:out value="${param.val}"/>" >
...
</custom:tag>

你只需要添加

${param.val} 

在下面的参数中 ...

关于jsp - JSTL 自定义标签变量替换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19385807/

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