You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Dean A. Hoover" <dh...@rochester.rr.com> on 2004/03/31 01:59:37 UTC

creating body content

I have been experimenting with creating
custom tags for a few days now and have
created some simple but useful tags for
my application. None of the tags I've
written so far use any body content. Now
I want to create a tag that does not have
a body but will "insert" JSP code that needs
to be evaluated. I am using struts and want
to use a struts tag in the generated JSP and
then have it evaluated. An example of the
tag I am creating would look like this:

<els:formlabel key="logon.password"/>

And it would insert the following:

<table cellpadding="0" cellspacing="0" width="150"><tr><td><bean:message 
key="logon.password"/></td></tr></table>

How would I go about doing this. I've been bouncing
around in the documentation trying to understand the
various return codes, such as EVAL_BODY_AGAIN,
and the BodyContent class, but I'm having trouble
understanding how to do this. Can someone
point me in the right direction?

Dean Hoover


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


RE: creating body content

Posted by Martin van Dijken <su...@windgazer.nl>.
Hey Dean,

A simple answer, it's not possible to do this. A tag is only allowed to
create Template text which is output directly to the client. So your HTML
etc would go fine, but your bean:message tag would be sent to the client
unparsed as well. There might be something you can do in JSP 2.0 using tag
files, but I haven't looked into it. If JSP 2.0 is an option for you, check
out the chapter on Tag Files in the JSP 2.0 specification.

Personally if you're already as far as creating your own tags, I'd search
through the Struts javadocs to see if you can't find the message yourself.
Check out the org.apache.struts.util and org.apache.struts.config packages.

Martin

-----Oorspronkelijk bericht-----
Van: Dean A. Hoover [mailto:dhoover@rochester.rr.com]
Verzonden: woensdag 31 maart 2004 2:00
Aan: taglibs-user@jakarta.apache.org
Onderwerp: creating body content


I have been experimenting with creating
custom tags for a few days now and have
created some simple but useful tags for
my application. None of the tags I've
written so far use any body content. Now
I want to create a tag that does not have
a body but will "insert" JSP code that needs
to be evaluated. I am using struts and want
to use a struts tag in the generated JSP and
then have it evaluated. An example of the
tag I am creating would look like this:

<els:formlabel key="logon.password"/>

And it would insert the following:

<table cellpadding="0" cellspacing="0" width="150"><tr><td><bean:message
key="logon.password"/></td></tr></table>

How would I go about doing this. I've been bouncing
around in the documentation trying to understand the
various return codes, such as EVAL_BODY_AGAIN,
and the BodyContent class, but I'm having trouble
understanding how to do this. Can someone
point me in the right direction?

Dean Hoover


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org