【发布时间】:2014-01-14 10:29:56
【问题描述】:
我在这里做错了什么:
<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" %>
摘自 tld
<?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>
【问题讨论】:
-
查看我在问题中的最后一句话。它根本不会被替换。我刚刚在您发表评论后再次尝试。同样的结果,我在自定义标签中得到了一个文字
${param.val}。 -
<custom:tag ... />是一个错字,请参阅更新的问题。不起作用的是我得到一个文字${param.val}而不是它的值。 -
您可以发布您的顶级域名吗?您是否为您的参数属性指定
<rtexprvalue>true</rtexprvalue>? -
好吧,整件事太长了。
<rtexprvalue>true</rtexprvalue>已设置。还有什么? -
只需发布相关标签...它不应超过 10-15 行,除非您有许多属性。没有更具体的细节,这只是一个猜谜游戏。