Mantis - Resin
Viewing Issue Advanced Details
2936 minor always 09-14-08 15:19 09-18-08 16:14
closed 3.1.6  
none 3.1.8  
0002936: Taglib usage fails in JSP tag file when prefixes vary
This bug has two aspects, using custom tags and using custom tag functions. If you define a custom tag library with a different prefix between a jsp and a jsp tag file the jsp is using, compilation of the jsp and tag will fail. For example, we have test.jsp:

<%@ taglib uri="" [^] prefix="c1" %>
<%@ taglib prefix="misc" tagdir="/WEB-INF/tags" %>

<c1:out value="This is a jsp" />


and a test.tag:

<%@ taglib uri="" [^] prefix="c2" %>

<c2:out value="This is a tag file" />

with auto compilation on, loading test.jsp results in the exception: com.caucho.jsp.JspLineParseException: /WEB-INF/tags/test.tag:1: org.xml.sax.SAXParseException: The prefix "c1" for element "c1:out" is not bound.

Applying the same pattern but this time trying to make use of JSTL functions, we have test.jsp:
<%@ taglib uri="" [^] prefix="fn1" %>
<%@ taglib prefix="misc" tagdir="/WEB-INF/tags" %>

${fn1:toUpperCase('this is a jsp file') }


and test.tag:

<%@ taglib uri="" [^] prefix="fn2" %>

${fn2:toUpperCase('this is a tag file')}

loading test.jsp results in the exception: com.caucho.el.ELParseException: 'fn2:toUpperCase' is an unknown function.

It we peek inside the java class created for test.tag, we see that the functions taglib has been mapped to the fn1 prefix: manager.addTaglibFunctions(_jsp_functionMap, "fn1", ""); [^]

09-18-08 16:14