Hi all,

I want to declare a function that prints out some HTML, something like:

--------- begin(index.jsp)
<%!
public void printSimpleHeader()
{
%>

<img src=<%= imageurl("simpleheader.gif") %> >
<!-- I actually have more HTML here, elided for sake of brevity -->

<%!
}
%>

<body>
<% printSimpleHeader(); %>
</body>
--------- end(index.jsp)

This doesn't work, the function ends up declared as empty and the HTML ends
up where the function is declared:

---------
<img src="/images/simpleheader.gif">
<body>
</body>
---------

I obviously have not wrapped my head around <% vs <%!. It seems that
all of the declarative (<%!) content is collected in one buffer, and the
rest is collected in another buffer. Is there a way for we to get the HTML
into the declarative buffer, and have it changed to java code?
Am I trying to do something that can't be done? I realize I could use
out.println, taglib, or XSL but I really don't want to do that.

Thanks,

Sam

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to