1

我收到“此属性不支持请求时间值”。在编译我的自定义 jsp 标签实现时。

我的顶级域名文件

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
    <tlibversion>1.0</tlibversion>
    <jspversion>1.1</jspversion>
    <shortname>My Extension</shortname>
    <info>Customization Extensions</info>
  <tag>
    <name>requireDisplay</name>
    <tagclass>com.view.LinksTag</tagclass>
    <teiclass>com.view.LinksTagExtraInfo</teiclass>
    <bodycontent>JSP</bodycontent>
    <info> My Tags Exercise
    </info>
  <attribute>
      <name>viewID</name>
      <required>true</required>
      <rtexpvalue>true</rtexpvalue>
  </attribute>
  <attribute>
      <name>viewType</name>
      <required>true</required>
      <rtexpvalue>true</rtexpvalue>
  </attribute>
</tag>
</taglib>

我的 JSP 标签实现有以下方法

/**
 * doStartTag is called by the JSP container when the tag is encountered
 */
public int doStartTag() throws JspException {
    try {
        JspWriter out = pageContext.getOut();
        out.println(getContent());
    } catch (Exception ex) {
        throw new ElmsUncheckedException(ex);
    }
    // Must return SKIP_PAGE because we are done with the content.
    return SKIP_BODY;
}

/**
 * getContent is called by the startTag to print the Request View button
 * contents.
 */
private String getContent() {
    String linkURL = ViewConstants.BASE_URL;
    StringBuffer sbuffer = new StringBuffer();
    sbuffer.append("<form name=\"postView\" action=\"" + linkURL + "\" target=\"_blank\" method=\"POST\">\n");
    sbuffer.append("<input type=\"hidden\" name=\"ID\" value=\"" + viewID + "\" />\n");
    sbuffer.append("<input type=\"hidden\" name=\"Type\" value=\"" + viewType + "\" />\n");
    sbuffer.append("<tr>\n");
    sbuffer.append("<td class=\"BodyBG\">\n");
    sbuffer
            .append("<button type=\"submit\" class=\"GridButton\" name=\"dispatch\" value=\"postView\">postView</button> \n");
    sbuffer.append("</td><td width=\"1\"></td>\n");
    sbuffer.append("</tr>\n");
    sbuffer.append("</form>\n");
    return sbuffer.toString();
}

public int doEndTag() throws JspException {
    resetVariables();
    return EVAL_PAGE;
}

我的jsp有以下

<%@ taglib uri="/WEB-INF/view.tld" prefix="cmd" %>

.....

<cmd:requireDisplay viewID="<%=vox.getViewID()%>" viewType="<%=vox.getViewType()%>"/>

但我收到以下异常

[jspc] Error encountered while compiling 'jspURI'
view_details.jsp:136:22: The required attribute "viewID" is missing.

                   <cmd:requireDisplay viewID="<%=vox.getViewID()%>" viewType="<%=vox.getViewType()%>"/>

                     ^----------------------^

view_details.jsp:136:22: The required attribute "viewType" is missing.

                   <cmd:requireDisplay viewID="<%=vox.getViewID()%>" viewType="<%=vox.getViewType()%>"/>

                     ^----------------------^

view_details.jsp:136:42: This attribute does not support request time values.

                   <cmd:requireDisplay viewID="<%=vox.getViewID()%>" viewType="<%=vox.getViewType()%>"/>

                                                         ^---------^

view_details.jsp:136:57: This attribute does not support request time values.

                   <cmd:requireDisplay viewID="<%=vox.getViewID()%>" viewType="<%=vox.getViewType()%>"/>

                                                                                                                         ^----------^

我错过了什么吗?就像在 tld 中一样,即使我也尝试提供 TagExtraInfo。但没有运气。

任何帮助深表感谢。

4

1 回答 1

2

我弄清楚了这个问题。这是一个错字:(

 <rtexpvalue>true</rtexpvalue>

条目假设是

 <rtexprvalue>true</rtexprvalue>
于 2008-11-19T23:29:52.097 回答