hola Pat,

this should be quite simple.

first make a Bean that can generate your HTML table, based on your treeBean.

for example...

public interface myTreeGenerator
{
    OutputStream getHtmlTable(treeBean);
}

all the HTML generation could be encapsulated inside it...

you then use the bean in your JSP, and insert the stream inside the page...using
traditional servlet code.

you got the idea?

any comments?

Stan

O'Keeffe Patrick wrote:

> Hello,
>
> I need to draw a tree of icons and organisation names in my JSP using
> organisation names stored in a bean. This is quite a complex tree and each node
> needs to be enclosed within its own <table> </table> tags. The tree will be
> drawn in different JSPs at different times. I would like to put the presentation
> aspects of drawing each tree node into a method which could then be called by
> any JSP as many times as there are organisations. The problem I have is this:
>
> I can construct a method which can included in any JSP file and called as and
> when necessary:
>
> <%!  public String DrawTree()
>      {
>           out.println("<tr> <td>Organisation</td></tr>");
>      }
> %>
>
> This is fine except that any HTML output has to be done using out.println()
> statements. It is (unfortunaltely) not possible to do this,
>
> <%!  public void DrawTree()
>      {
> %>
>           <tr> <td>Organisation</td></tr>
> <%
>      }
> %>
>
> which would be ideal, becuase its esier to see what going on in the HTML, and
> anyway, HTML people are easily put off by Java statements (yes, even
> out.println()s). The above example seems simple, but when you have multiple
> images displayed which depend on where you are in the tree, you'd rather get
> away from out.println()s becuase it becomes a lot more tricky to maintain and an
> eyesore.
>
> Is there a way to define (helper) methods in JSP (as you can in ASP) in which
> the HTML does not have to be enclosed in out.println() statements. Am I being
> stupid or is this an area where ASP has the upper hand over JSP??
>
> Your input would be appreciated.
>
> Patrick.
>
> Tertio Limited  -  One Angel Square,   Torrens Street,   London  EC1V 1NY
> Tel: +44 (0)171 843 4000 Fax: +44 (0)171 843 4001 Web http://www.tertio.com
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of Tertio Ltd.
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
begin:vcard
n:Pinte;Stanislas
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
fn:Stanislas Pinte
end:vcard

Reply via email to