TLD 为自定义标签指定了无效的正文内容 (EMPTY)

TLD specifies invalid body-content (EMPTY) for custom tag

我有这个错误:"TLD specifies invalid body-content (EMPTY) for custom tag mundo" 这个 taglib 创建有什么问题?

AlomMundoTLD.jsp

    <%-- 
        Document   : alomundoTLD
        Created on : 20/04/2015, 15:59:42
        Author     : Jessica
    --%>

    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ taglib uri="AloMundo.tld" prefix="alo" %>

    <!DOCTYPE html> <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title><alo:mundo /> JTLB</title>
        </head>
        <body>
            <h1><alo:mundo /></h1>
        </body> </html>

AloMundo.tld

<?xml version="1.0" encoding="UTF-8"?> <taglib version="2.1" 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">   <tlibversion>1.0</tlibversion>   <jspversion>1.1</jspversion>   <shortname>alo</shortname>   <info>TabLib de Alo Mundo!!!</info>   <tag>
      <name>mundo</name>
      <tagclass> tagLib.AloMundo</tagclass>
      <info>Devolve Alo Mundo</info>
      <bodycontent>EMPTY</bodycontent>   </tag> </taglib>

AloMundo.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package tagLib;

import java.io.IOException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

/**
 *
 * @author Jessica
 */
public class AloMundo extends TagSupport  {
    public int doStartTag(){
        JspWriter saida = pageContext.getOut();
        try{
            saida.print("Alo mundo!!!");
        }
        catch (IOException e){
            e.printStackTrace();
        }

        return SKIP_BODY;
    }
}

请帮我确定上面的 jsp 标签有什么问题。

<?xml version="1.0" encoding="UTF-8"?> <taglib version="2.1" 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">   <tlibversion>1.0</tlibversion>   <jspversion>1.1</jspversion>   <shortname>alo</shortname>   <info>TabLib de Alo Mundo!!!</info>   <tag>
  <name>mundo</name>
  <tagclass> tagLib.AloMundo</tagclass>
  <info>Devolve Alo Mundo</info>
  <bodycontent>empty</bodycontent>   </tag> </taglib> 

您的正文内容需要为空,而不是根据 XSD 的 EMPTY,如下所示:

<xsd:simpleContent>
      <xsd:restriction base="javaee:string">
    <xsd:enumeration value="tagdependent"/>
    <xsd:enumeration value="JSP"/>
    <xsd:enumeration value="empty"/>
    <xsd:enumeration value="scriptless"/>
      </xsd:restriction>
    </xsd:simpleContent>