Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JSP Interest »

ELExpressions in SimpleTags

Erik Hansson

2003-09-04

Replies:

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

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:
---------
<%@(protected)" %>
<%@(protected)" %>

<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"/>

===========================================================================
To unsubscribe: mailto listserv@(protected)".
For digest: mailto listserv@(protected)".

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


©2008 junlu.com - Jax Systems, LLC, U.S.A.