tags:

views:

1039

answers:

3

I am getting the "This attribute does not support request time values." while compiling my custom jsp tag implementation.

My TLD file

<?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"&gt;
<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>

My JSP Tag Implementation has the following method

/**
 * 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;
}

my jsp has the following

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

.....

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

But i am getting the following exception

[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()%>"/>

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

Am i missing anything? As in the tld, even i tried to give TagExtraInfo too. But no luck.

Any help is much appreciated.

A: 

Do you have getters/setters for linkURL and viewID on your tag implementation class ?

krosenvold
A: 

Yes I do. The variables are private but the getter and setters are public as per bean standards

+1  A: 

I figured out the issue. It is a typo :(

 <rtexpvalue>true</rtexpvalue>

entry suppose to be

 <rtexprvalue>true</rtexprvalue>