Bug 47977 - body-content of empty in TLD ignored for JSP Documents
body-content of empty in TLD ignored for JSP Documents
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Servlet & JSP API
6.0.20
All All
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-10-10 13:39 UTC by jcorallo
Modified: 2010-03-05 18:36 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jcorallo 2009-10-10 13:39:39 UTC
If <body-content>empty</body-content> is specified in the TLD, it is ignored for JSP Documents but not for JSP Pages (for JSP Pages the container correctly returns "According to TLD, tag <prefix>:<tag_name> be empty, but is not"

Below are my test files:


TestBodyContentEmptyBug.jspx:

<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:jcc="TestBodyContentEmptyBug" >   
<jsp:directive.page contentType="text/html" />   
<html>   
<head>   
</head>   
<body>   
<pre>   
  
  
<jsp:text>About to call TestBodyContentEmptyBug...</jsp:text>   
<jcc:TestBodyContentEmptyBug />   
<jsp:text>Done calling TestBodyContentEmptyBug...</jsp:text>   
<hr/>   
  
  
<jsp:text>About to call TestBodyContentEmptyBug with a body...</jsp:text>   
<jcc:TestBodyContentEmptyBug >   
Hello from the body of TestBodyContentEmptyBug... this body should cause an error... should it not?   
</jcc:TestBodyContentEmptyBug >   
<jsp:text>Done calling TestBodyContentEmptyBug...</jsp:text>   
<hr/>   
  
  
</pre>   
</body>   
</html>   
</jsp:root>  





TestBodyContentEmptyBug.tld:

<?xml version="1.0" encoding="ISO-8859-1" ?>   
  
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"  
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">   
  
        <tlib-version>2.0</tlib-version>   
        <uri>TestBodyContentEmptyBug</uri>   
        <tag>   
                <description>This is the description TestBodyContentEmptyBug</description>   
                <name>TestBodyContentEmptyBug</name>   
                <tag-class>mypackage.TestBodyContentEmptyBug</tag-class>   
                <body-content>empty</body-content>   
        </tag>   
</taglib>  






TestBodyContentEmptyBug.java:

package mypackage;   
  
import javax.servlet.jsp.PageContext;   
import javax.servlet.jsp.JspException;   
import javax.servlet.jsp.tagext.Tag;   
  
  
public class TestBodyContentEmptyBug implements Tag {   
  
    private PageContext pageContext = null;   
    private Tag parent = null;   
  
    public void setPageContext(PageContext p) {   
        pageContext = p;   
    }   
  
  
    public void setParent(Tag t) {   
        parent = t;   
    }   
  
  
    public Tag getParent() {   
        return parent;   
    }   
  
  
    public int doStartTag() throws JspException {   
        return Tag.EVAL_BODY_INCLUDE;   
    }   
  
  
    public int doEndTag() throws JspException {   
        return EVAL_PAGE;   
    }   
  
  
    public void release() {   
        pageContext = null;   
        parent = null;   
    }   
  
  
}  






Filename web.xml:

<web-app version="2.4">   
  
  <description>This is the optional description of the web-app1</description>   
  
</web-app>
Comment 1 Mark Thomas 2010-01-11 16:13:27 UTC
This has been fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2010-01-14 02:35:11 UTC
This has been fixed in 6.0.x and will be included in 6.0.23 onwards.
Comment 3 Konstantin Kolinko 2010-03-05 18:36:34 UTC
There was a regression caused by the fix to this issue: Bug 48827.
The fix for this issue was reimplemented to fix both this bug and bug 48827 and was applied to 6.0.x in r919354 and will be in 6.0.26 onwards.