Bug 47977

Summary: body-content of empty in TLD ignored for JSP Documents
Product: Tomcat 6 Reporter: jcorallo <julian.corallo>
Component: Servlet & JSP APIAssignee: Tomcat Developers Mailing List <dev>
Severity: normal CC: julian.corallo
Priority: P2    
Version: 6.0.20   
Target Milestone: default   
Hardware: All   
OS: All   

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:


<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:jcc="TestBodyContentEmptyBug" >   
<jsp:directive.page contentType="text/html" />   
<jsp:text>About to call TestBodyContentEmptyBug...</jsp:text>   
<jcc:TestBodyContentEmptyBug />   
<jsp:text>Done calling TestBodyContentEmptyBug...</jsp:text>   
<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>   


<?xml version="1.0" encoding="ISO-8859-1" ?>   
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"  
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0">   
                <description>This is the description TestBodyContentEmptyBug</description>   


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>   
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.