How about having a HTML wraper class that represent a HTML control that will
generate all
the HTML tags for a particular control when calls toString(). For example you can
have a
class call HtmlSelectionBox that might be extended for a general HtmlControl class
that can
be constructed with a Collection of objects, and implements all the accessor an
multator
methods that a JSP deverloper can calls to set all the attributes of a selection
box, and the
toString() methods get calls, it will iterate to the entire collection and generate
all the HTML
tags and attribute for that particular control.
Ashwani Kalra wrote:
> My suggestion is just get the columns from the ejb. And do all formatting
> in jsp.Which provides more flexibility.
>
> Ashwani
>
> > ----------
> > From: D. J. Hagberg
> > Reply To: [EMAIL PROTECTED]
> > Sent: Sunday, February 20, 2000 2:28 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: HTML from a bean?
> >
> >
> >
> > A couple possibilities:
> > - returning an array of Strings (or Objects with appropriate toString
> > methods) works well if you know your result sets will be small and that
> > the creation of a bunch of temporary objects is not a huge deal.
> > - for larger or unknown-length result sets, you might consider providing
> > accessor methods so that the .jsp page can simply get the
> > java.sql.ResultSet, though you will need to wrap things in a try/finally
> > block inside the .jsp to ensure the underlying Statement is close()'d
> > before you return.
> > - As an alternative to providing direct access to the ResultSet, which
> > can be ugly for .jsp artist-types to program, you could wrap the
> > ResultSet with a kinder/gentler type of enumerated interface. Same
> > problem with needing a try/finally block in the .jsp page to close
> > things up.
> >
> > -=- D. J.
> >
> > John Parrish wrote:
> > > What is the preferred method of generating HTML back to a JSP page from
> > a
> > > bean? I was thinking about possibly returning a String array containing
> > > lines to be outputted and having JSP code loop and print. My scenario
> > would
> > > be a bean that executes an SQL query and generates and HTML table with
> > the
> > > results. I am very new to JSP so if I need prodding in a different
> > > direction, by all means prod! :) Regards
> >
> > ==========================================================================
> > =
> > 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
> >
> >
> >
> Visit http://www.niit.com for eCommerce Solutions.
>
> ===========================================================================
> 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
===========================================================================
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