Bug 49555 - Custom Taglibs should support all parameters
Summary: Custom Taglibs should support all parameters
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2010-07-05 18:13 UTC by james_calfee
Modified: 2011-04-15 07:39 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description james_calfee 2010-07-05 18:13:53 UTC
I added two method <function>s with the same name but with an addition parameters.  I get this error:

org.apache.jasper.JasperException: Duplicate function name list in tag library /WEB-INF/dataStore.tld

Crap!  It is not even looking at the parameters.  Ok, Java matches on method names and method parameters.  It is commonly called a method signature. 

Well, Jasper is in the Google SDK, so it could perhaps be smarter than I am -- so maybe I overlooked something.  Is that the case?

Why can't the Jasper compiler match on parameters like Java?  This is after all Java.  I'm only using TLDs because they are cleaner then escaping Java code in JSP.  I have already wrote a considerable amount of TLD code and it does not easily mix with the expression language.  This is the reason why it is so important to have this implementation work as expected.

Please let me know how I can help.  Lets get this fixed.


AppEngine SDK 1.3.2 (sorry, I don't know the embedded Jasper version)
Comment 1 james_calfee 2010-07-05 18:30:00 UTC
I have an architecture that uses static inner classes.  After about an hour of trial and error and internet searches, I discovered that I can not use a Static inner class as a method parameters in my TDL file.  This is the error:

org.apache.jasper.JasperException: /WEB-INF/jsp/page.jsp(19,2) The function listElement cannot be located with the specified prefix

No, it is there.  It can't find the parameter: 

It simply can not find my method.  I know I have it correct because I can replace the static inner class parameter with a top-level class (MyClass).  I can then call my static function.

The more important part of my program relies on static inner classes.  There are a number of them.  I did this by design to represent a simple structure that is best coded in a single file.  I'm not changing this part of the program.  Unfortunately, escaping Java code in JSP pages does not mix well with JSP expression language.  Also, I have a decent amount of expression language code.  So, I really need the jasper compiler have basic support for Java constructs.  Can you help please?

I'm using the Google AppEngine SDK 1.3.2.  I'm sorry, I do not see the Jasper version.  I only see the apache jasper package name in my exception.

Please let me know if I can help. 

Comment 2 Mark Thomas 2010-07-06 01:28:32 UTC
It is likely to be Tomcat 6 that is being used rather than Tomcat 7 but any fix in Tomcat 7 will get back-ported to Tomcat 6 so lets not worry too much about that.

I think I understand the problem you are seeing but it would help if you could attach the source for the simplest possible test case that demonstrates the issue (I'd expect 1*JSP, 1*TLD, 1*Java class & 1* web.xml)

I do wonder if this is an issue between com.example.MyClass.MyInnerStaticClass
 and com.example.MyClass$MyInnerStaticClass? There was a similar issue (bug 35351) some time ago.
Comment 3 Mark Thomas 2010-07-08 11:52:09 UTC
No response in 2 days. Can't be that critical. Reduce severity to normal.

Since the OP hasn't provided a test case, I'll see about creating one based on what I think the issue is.
Comment 4 Mark Thomas 2010-07-08 17:31:41 UTC

Fixed in 7.0.x and will be in 7.0.1 onwards.

Proposed for 6.0.x
Comment 5 Mark Thomas 2011-01-07 12:46:40 UTC
This has been fixed in 6.0.x and will be included in 6.0.30 onwards.
Comment 6 Rowan Seymour 2011-04-15 06:21:00 UTC
(In reply to comment #5)
> This has been fixed in 6.0.x and will be included in 6.0.30 onwards.

Fix for this bug seems to have removed the ability to use EL functions in classes which are not accessible to Catalina's class loader, i.e. ELFunctionMapper now calls something like...

tccl = Thread.currentThread().getContextClassLoader();
clazz = Class.forName(className, true, tccl);

In our app we have custom loader that provides classes from plugins for the application. Previously these plugins were able to provide their own EL functions but that broke in 6.0.30
Comment 7 Mark Thomas 2011-04-15 07:39:50 UTC
The EL implementation assumes that the tccl will be the web application class loader and that all classes used by the web applciation will be visible to that class loader. Depending on why you need a custom class loader then there are a couple of options available including a custom loader and the VirtualWebappLoader. The users list is the place to get help on which is best for your use case.