Thanks for confirming it's not possible. I didn't think so; but wanted to
make sure before I wrote my own HTML generator. For the limited amount of
HTML I'll need I can write a HTML generator in a day or so.

I don't suppose it's possible to use the Struts compiler directly? - Feed it
the Struts tagged code and have it spit out the HTML into a String?

Thanks,

--BobC

-----Original Message-----
From: Paul Benedict [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 25, 2006 1:18 PM
To: Struts Users Mailing List
Subject: Re: Possible to programmatically create and use tags?


No, that is not possible. This is not a limitation of Struts, but because of
the way JSP is constructed.

JSP Engines scan the swiping <% %> as real code, and invoking JSP tags  --
the rest is simply out.println() statements. You cannot do what your saying
because the JSP Engine would have to take two passes to produce your JSP:
first to get the created page, the second to then do it again.

If you need to do conditionals, do something like this:
<c:if test="${condition"}>
  struts tags here
</c:if>

Bob Carpenter <[EMAIL PROTECTED]> wrote: Hi,

Is it possible to programmatically create HTML blocks that include struts
tags and include them in a JSP?

Here's a simple example which fails to produce the text field defined by the
html:text tag:

------------
<%@ page language="java" errorPage="ErrorPage.jsp" contentType="text/html"
%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>








<%
    try {
 StringBuffer sbuf = StringBuffer();
        sbuf.append("");
        sbuf.append("   ");
        sbuf.append("     Employee Name: ");
        sbuf.append("     styleClass=\"FORM_FIELDS\" >");
        sbuf.append("     ");
        sbuf.append("   ");
        sbuf.append("");
        String variableHeaderHTML = sbuf.toString();
%>




            <%= variableHeaderHTML %>




<%
    }
    catch(Exception ex) {
        System.out.println("ERROR: " +ex.toString());
    }
%>




---------------
Thanks,

--BobC


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------
Yahoo! Groups gets better. Check out the new email design. Plus there’s much
more to come.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to