You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin HaleBoyes <kc...@yahoo.com> on 2001/09/11 19:55:01 UTC

Repost: taglib and rtexprvalue problem/bug

I posted this the other day but no one responded.
I've since moved from Tomcat 4.0-b7 to 4.0-rc1 and the
problem still exists so I thought I would try again...


I have one jsp that <jsp:include>'s another and augments the
request parameters using <jsp:param>.  The included jsp uses a
taglib tag with the <rtexprvalue> attribute set to true.

The problem is I keep getting the following exception when I use
an expression in the attribute field:

    org.apache.jasper.compiler.ParseException:
            /WEB-INF/jsp/od.jsp(12,53) Attribute from has no value

Here is the taglib.tld excerpt:

    <!DOCTYPE taglib
       PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
       "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

    <tag>
     <name>orderDetail</name>
     <tagclass>taglib.orddet.OrderDetailsTag</tagclass>
     <bodycontent>JSP</bodycontent>
     <info></info>

     <attribute>
      <name>from</name>
      <required>true</required>
      <rtexprvalue>true</rtexprvalue>
     </attribute>
    </tag>

The outer jsp file is simple:

     <html><head><title>Test</title></head>
     <body><center><h1>Test</h1></center>
     <jsp:include page="/WEB-INF/jsp/od.jsp">
       <jsp:param name="from" value="p:D"/>
     </jsp:include>
     </body></html>

And the included jsp file isn't much more complicated:

    <%@ taglib uri="/WEB-INF/tlds/taglib.tld" prefix="opf" %>

    <pre>od.jsp<br />
    <%= request.getParameter("from") %></pre>

    <opf:orderDetail from="<%= request.getParameter("from") %>">
      PO Number:<opf:orderAttr attribute="ponumber"/>
    </opf:orderDetail>

If I use the included file as shown then I get the
'Attribute from has no value' Parse exception.  If I replace the
<opf:orderDetail> line to a static string
<opf:orderDetail from="p:D">
then the file gets included just fine __and__ the
getParameter() call
at the top shows that the parameter is, in fact, set.

I really don't understand what I'm doing wrong and would appreciate
any help.  This is Tomcat 4.0-rc1 on Linux RedHat 7.1.

Kevin HaleBoyes



____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

Re: Repost: taglib and rtexprvalue problem/bug

Posted by "Craig R. McClanahan" <cr...@apache.org>.
I just answered this in the bug report, but will answer here as well since
it's been raised here.

Request URIs (including the query string) processed by servlet containers
must conform to the requirements of HTTP.  In this case, the relevant spec
is RFC 2396, Section 3.2, which describes the legal syntax for query
strings.  In particular, characters like ':' and '=' are *reserved*, and
must be URL encoded in order to be processed.

This same requirement, therefore, applies to query parameters included
with <jsp:include> and RequestDispatcher.include().

Craig McClanahan


On Tue, 11 Sep 2001, Kevin HaleBoyes wrote:

> Date: Tue, 11 Sep 2001 18:55:01 +0100 (BST)
> From: Kevin HaleBoyes <kc...@yahoo.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Repost: taglib and rtexprvalue problem/bug
>
> I posted this the other day but no one responded.
> I've since moved from Tomcat 4.0-b7 to 4.0-rc1 and the
> problem still exists so I thought I would try again...
>
>
> I have one jsp that <jsp:include>'s another and augments the
> request parameters using <jsp:param>.  The included jsp uses a
> taglib tag with the <rtexprvalue> attribute set to true.
>
> The problem is I keep getting the following exception when I use
> an expression in the attribute field:
>
>     org.apache.jasper.compiler.ParseException:
>             /WEB-INF/jsp/od.jsp(12,53) Attribute from has no value
>
> Here is the taglib.tld excerpt:
>
>     <!DOCTYPE taglib
>        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
>        "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
>
>     <tag>
>      <name>orderDetail</name>
>      <tagclass>taglib.orddet.OrderDetailsTag</tagclass>
>      <bodycontent>JSP</bodycontent>
>      <info></info>
>
>      <attribute>
>       <name>from</name>
>       <required>true</required>
>       <rtexprvalue>true</rtexprvalue>
>      </attribute>
>     </tag>
>
> The outer jsp file is simple:
>
>      <html><head><title>Test</title></head>
>      <body><center><h1>Test</h1></center>
>      <jsp:include page="/WEB-INF/jsp/od.jsp">
>        <jsp:param name="from" value="p:D"/>
>      </jsp:include>
>      </body></html>
>
> And the included jsp file isn't much more complicated:
>
>     <%@ taglib uri="/WEB-INF/tlds/taglib.tld" prefix="opf" %>
>
>     <pre>od.jsp<br />
>     <%= request.getParameter("from") %></pre>
>
>     <opf:orderDetail from="<%= request.getParameter("from") %>">
>       PO Number:<opf:orderAttr attribute="ponumber"/>
>     </opf:orderDetail>
>
> If I use the included file as shown then I get the
> 'Attribute from has no value' Parse exception.  If I replace the
> <opf:orderDetail> line to a static string
> <opf:orderDetail from="p:D">
> then the file gets included just fine __and__ the
> getParameter() call
> at the top shows that the parameter is, in fact, set.
>
> I really don't understand what I'm doing wrong and would appreciate
> any help.  This is Tomcat 4.0-rc1 on Linux RedHat 7.1.
>
> Kevin HaleBoyes
>
>
>
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
>