This discussion is archived
0 Replies Latest reply: Oct 28, 2012 7:56 PM by 872042 RSS

Recursive calls by JSP tag files fail to compile

872042 Newbie
Currently Being Moderated
We're hitting an issue with recursive calls in JSP tag files. I found one unanswered post in the General forum - [Tag Files used recursivily throws exception|https://forums.oracle.com/forums/thread.jspa?threadID=853300] - and was wondering if anyone else has hit this or knows of any work-arounds/patches or knows how to raise suspected bugs with Oracle (when you don't have an official support relationship for WebLogic)?

Example tag file - /WEB-INF/tags/recurse/hello.tag:
---------------------------------------------
<%@ tag body-content="empty" %>
<%@ attribute name="name" required="true" type="java.lang.String"%>
<%@ attribute name="depth" required="true" type="java.lang.Number"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="r" uri="/WEB-INF/tags/recurse/recurse.tld" %>
<table border="1" cellpadding="3" cellspacing="3">
<tr>
<td>
Hello ${name} [${depth}]
</td>
<c:if test="${depth > 1}">
<td>
<r:hello name="${name}" depth="${depth-1}"/>
</td>
</c:if>
</tr>
</table>
---------------------------------------------

Example tld file - /WEB-INF/tags/recurse/recurse.tld:
---------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">

<description>Library with Recursive tag</description>
<tlib-version>1.0</tlib-version>
<shortname>r</shortname>

<tag-file>
<name>hello</name>
<path>/WEB-INF/tags/recurse/hello.tag</path>
</tag-file>
</taglib>
---------------------------------------------


Example jsp file - /recurse/test.jsp:
---------------------------------------------
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="r" uri="/WEB-INF/tags/recurse/recurse.tld" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Recursive Tag-file Test</title>
</head>
<body>
<c:set var="name" value="${pageContext.request.remoteUser}"/>
<c:set var="depth" value="${5}"/>
<p>Welcome ${name}, here are ${depth} greetings</p>
<r:hello name="${name}" depth="${depth}"/>
</body>
</html>
---------------------------------------------

The expected result from this example would be to get nested 5 HTML tables.


The current behaviour, is the following is shown on screen when loading the test.jsp:
---------------------------------------------
Compilation of JSP File '/recurse/test.jsp' failed:

hello.tag:15:6: Current file's JSP version conflicts with current tag "r:hello"'s.
                    <r:hello name="${name}" depth="${depth-1}"/>
^-----^
hello.tag:15:6: Current file's JSP version conflicts with current tag "r:hello"'s.
                    <r:hello name="${name}" depth="${depth-1}"/>
^-----^
---------------------------------------------

I believe the "JSP version conflicts with current tag" message is misleading (you also get the same error referring to the tag file's folder via a tagdir reference from the JSP and defining an 'implicit.tld' which declares version="2.1"). If you take the recursive <r:hello .../> call out of hello.tag the JSP and tag file compile and function fine. I tried the work around mentioned in the forum post mentioned above, taking the recursive call out, deploying, then putting the recursive tag call back in and just updating the tag file doesn't seem to work for me.


Using "weblogic.appc" you get a few more messages, though the issue is the same - tag file doesn't compile:
---------------------------------------------
test.jsp:15:6: The tag handler class was not found "jsp_servlet._tags._recurse.__hello_tag".
<r:hello name="${name}" depth="${depth}"/>
^-----^
test.jsp:15:14: This attribute is not recognized.
<r:hello name="${name}" depth="${depth}"/>
^--^
test.jsp:15:29: This attribute is not recognized.
<r:hello name="${name}" depth="${depth}"/>
^---^
hello.tag:15:6: The tag handler class was not found "jsp_servlet._tags._recurse.__hello_tag".
<r:hello name="${name}" depth="${depth-1}"/>
^-----^
hello.tag:15:6: Current file's JSP version conflicts with current tag "r:hello"'s.
<r:hello name="${name}" depth="${depth-1}"/>
^-----^
---------------------------------------------

Happy to send this example as an ear/war for anyone that's interested.
At this stage, WebLogic seems to be the only servlet container with this limitation.
This has been tested with WebLogic 10.3.3.0 and 12.1.1.0.

The context for this is that the issue is present in a (larger) enterprise application. The above simple example with recursive tags is what we have isolated as the problem.

Although I/we may not have a support relationship for WebLogic, our clients will, so if the solution is apply an already existing patch that solution would be acceptable.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points