tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darryl Miles <darryl-mailingli...@netbauds.net>
Subject JSP 2.x *.tag files with "<%@ attribute" problem
Date Sat, 10 Jun 2006 06:59:15 GMT

[This mail was original sent to the tomcat-users list, but solicited no 
response, so I now put it to the tomcat-dev list to confirm there isn't 
something blatantly wrong with my understanding of how *.TAG files 
work.  My original post: 
http://marc.theaimsgroup.com/?l=tomcat-user&m=114407501224248&w=2 ]


My question is about the use of *.tag files, to have the container (TC) automatically
build tag libraries from my test.tag file.  But some aspects don't work as I would
naturally expect and I don't know if this is my lack of understanding or a genuine
bug.

When I use <%@ attribute name="vvAbcDefGhi" required="false" ... %> I have no
problem.

Now when I start to alter the name="" value so that it uses the values:

vvAbcDefGhi (no problem here)
vvabcdefghi (no problem here)
vAbcDefGhi (does not work for me, I would expect this to be ok, this is the principal bug)
AbcDefGhi (does not work for me, I'm less sure if this is ok but can't see any reason
why it isn't allowed providing the name does not clash with another defined attribute
called abcDefGhi; as that would make substitution of ${abcDefGhi} ambiguous because it gets
normalized to getAbcDefGhi() in the generated code; worst case scenario if this isn't allow
and
is spotted TC should emit an error and refuse to compile the *.TAG code)

When I say it does not work for me I can get an error out of TC about being unable to find
the
setter function of the generated tag library.

STACK: org.apache.jasper.JasperException: /test.jsp(*5,0*) Unable to find setter method for
attribute: vAbcDefGhi


There is a function in org/apache/jasper/compiler/Generator.java which seems to do
the business #generateTagHandlerAttributes(TagInfo tagInfo) converts it into code.  I
have tested the methods #toGetterMethod(String) and #toSetterMethodName(String) with
my tag attribute names above and I get expected case conversion. 



Here is a cut and paste of the parts I think are relevant to allow you to see the bug, I have
tested with 5.5.17.


WEB-INF/tags/test.tag:

<%@ tag language="java" pageEncoding="UTF-8" body-content="scriptless" %>
<%@ attribute name="vvAbcDefGhi" required="false" rtexprvalue="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" <http://java.sun.com/jsp/jstl/core>
%>
...SNIP...
My HTML is here ${vvAbcDefGhi}
...SNIP...


test.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8" 
pageEncoding="UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd" <http://www.w3.org/TR/html4/loose.dtd>>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
...SNIP2...
<tags:test vvAbcDefGhi="value1" />
...SNIP2...



-- 
Darryl L. Miles



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message