Mantis - Resin
Viewing Issue Advanced Details
2936 minor always 09-14-08 15:19 09-18-08 16:14
jlawrie  
ferg  
normal  
closed 3.1.6  
fixed  
none    
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="http://java.sun.com/jsp/jstl/core" [^] prefix="c1" %>
<%@ taglib prefix="misc" tagdir="/WEB-INF/tags" %>

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


<misc:test/>

and a test.tag:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" [^] 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="http://java.sun.com/jsp/jstl/functions" [^] prefix="fn1" %>
<%@ taglib prefix="misc" tagdir="/WEB-INF/tags" %>

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


<misc:test/>

and test.tag:

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" [^] 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", "http://java.sun.com/jsp/jstl/functions"); [^]

Notes
(0003465)
ferg   
09-18-08 16:14   
jsp/1122