You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Gideon, Thomas" <Th...@B2eMarkets.com> on 2002/10/03 22:00:34 UTC

RE: struts tags in java file

Karen,

No, because they way you written this code, you are already outputting
directly to the response, rather than invoking the translation and execution
phases of the JSP container, which is when and where custom tags, like
<html:link/>, get evaluated.

You could invoke the tag handler class directly, but you'd have to mimic the
JSP container life cycle for tags, calling all of the attribute setters, and
the various Tag interface methods in the right order.  This is nasty.

You could put the HTML you're looking to output here in its own separate JSP
than use the RequestDispatcher to invoke a forward against it, which would
result in fully parsed output you could get at within your own tag.

Or, lastly, if you know HTML well enough to know what output of the
<html:link/> tag would be, you could just replace the custom tag markup in
your example with the valid, corresponding HTML output, instead.

Thomas Gideon
Sr. Software Developer
B2eMarkets

301.230.2236  Tel.
301.230.2248  Fax.
thomas.gideon@B2eMarkets.com
www.B2eMarkets.com


> -----Original Message-----
> From: Karen.Sharkey-Hall@marsh.com 
> [mailto:Karen.Sharkey-Hall@marsh.com]
> Sent: Thursday, October 03, 2002 3:52 PM
> To: struts-dev@jakarta.apache.org
> Subject: struts tags in java file
> 
> 
> Is it possible to use struts tags in a java file by using the
> pageContext.getOut().print to send the tag to a jsp page.
> 
> Here is an example:
> 
> public class MyTag extends TagSupport  {
> 
> public int doEndTag() {
> 
>       pageContext.getOut().print("<TABLE width=100%>");
>       pageContext.getOut().print("<TR class='trstandard'>");
>       pageContext.getOut().print("<TD><html:link 
> page='//login.jsp'>Login</html:link></TD>");
> 
>       return EVAL_PAGE;
> }
> }
> 
> Thanks,
> Karen
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>