Erik Hansson wrote:
Hi,

I'm having some trouble with custom tags that implement SimpleTag,
namely that they are not evaluating the body-content. When i run
invoke() on the "jspBody", I get the unprocessed contents of the tag.

I figured this had to do with the body-content of my tags not being
declared as JSP, but since Tomcat won't allow that, I'm running out of
ideas... Anyone care to enlighten me? I've been at my books and the
spec, but I only get the feeling it's working for everyone else. =)

I'm testing this on Tomcat 5.09.

Sample below...

You need to specify the body-content as "scriptless", a new keyword added for bodies that contain actions and EL expressions, but no scripting elements.

Other than that, your sample looks fine.

Hans

Thanks,
Erik Hansson


Tag class: ----------

public class TextTag extends SimpleTagSupport {
    public void doTag() throws JspException,
        StringWriter content = new StringWriter();
        JspFragment body = getJspBody();
        body.invoke(null);
    }
}


In TLD: ------- <tag> <name>text</name> <tag-class>com.melldrin.taglib.TextTag</tag-class> <body-content>tagdependent</body-content> </tag>


JSP-page: --------- <%@ taglib uri="http://www.melldrin.com/util"; prefix="mell" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt"; prefix="c" %>

<h1>testing mail-tags</h1>
<c:set var="varen" value="Detta �r inneh�llet i varen"/>
<mell:text>
    Hej ${varen}
    <c:out value="Test"/>
</mell:text>


Result: ------- <h1>testing mail-tags</h1>

Hej ${varen}
<c:out value="Test"/>


--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com

Reply via email to