The typical approach would be to do the database query first, and store
the result in a collection. This way you can get any error handling out
of the way, before you start rendering the view, and you also know how
many records you will have going in. (And avoid rendering a inexcusably
long page to your users.-)
Using that approach, the Struts custom tag library has an Iterate tag
that you could use. In this example, meetings is now a collection (in
any scope) of meeting beans, with code and description properties. It
also uses another handy Struts tag, Bean.
<logic:iterate id="mtg" name="meetings">
<tr>
<td>Meeting Code <td> <bean:write name="mtg"
property="code">
<td>Meeting Description <td> bean:write name="mtg"
property="description">
</tr>
</logic:iterate>
Struts is actually a framework, but the custom tags have uses in almost
any Model 2 application. < http://jakarta.apache.org/struts >
Just a suggestion. Your mileage may vary.
-Ted.
*********** REPLY SEPARATOR ***********
On 1/26/2001 at 11:24 AM Mayuresh Kadu (Aftek Infosys, Pune) wrote:
hello fellas
have run into a small prob. I have made a custom tag that accesses a
database and prints the same. What i need is that, as the theory says,
to be
able to seperate the processing logic with presentation logic. My tag
looks
as follows :
<html>
<mtp:meetings >
<tr>
<td>Meeting Code <td> /* i want title to appear here> */
<td>Meeting Description <td> /* Description */
</tr>
</mtp:meetings>
</html>
Now, i am to get to repeat the <tr><td> to repeat for as many records
as i
have. However, where i am stuck is to get the data to appear in the
place of
comments -- any suggestions ?!!
tia
Mayuresh
========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/about/struts/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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