Yes, I get the overall architecture of how to do it now. I'm somewhat
new to 'beans' and haven't used a collection before but I have more to
research now while I try to figure it out.

Thank you all for your responses!


-----Original Message-----
From: Robert Taylor [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 02, 2004 2:34 PM
To: Struts Users Mailing List
Subject: RE: Struts and Displaying data from a database

Have the business logic (where ever it may reside) return a collection
of JavaBean. You can simply place the collection in some scope (request,
session, etc..)
and render it on the JSP page using JSTL (for-each) or Struts iterate
tag.

You basically define an action mapping which will be invoked before
displaying
the .jsp page. The action delegates to the business logic (which does
the work
of retrieving the data) and then places the returned collection in some
scope.
The action then forwards to the appropriate .jsp page.


Does this help?

robert

> -----Original Message-----
> From: dbm_mailinglist [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 02, 2004 2:25 PM
> To: Struts Users Mailing List
> Subject: RE: Struts and Displaying data from a database
> 
> 
> I guess that's where I get lost. What does the bean return so that it
> can display multiple rows in the JSTL/JSP? I guess the type of the
> 'getter' would be some type that allowed you to loop through the
> data....an array maybe?
> 
> Do you know if there are any examples on the web? I'm trying to stick
to
> just JSP/JSTL/Servlets/Java and trying to steer away from additional
> tools like Hibernate.
> 
> Thank you much!
> 
> 
> -----Original Message-----
> From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 02, 2004 2:02 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Struts and Displaying data from a database
> 
> > I'm a complete newbie to Struts. I know how to use Struts to 
> > build forms and submit them, but how do I just display data 
> > from a database? I want a screen that just displays data from 
> > a sql command to a database and displays the results in a 
> > html table. Do I use ActionForm even though I don't have a 
> > form? I haven't been able to find any good examples on the web.
> 
> You don't necessarily need an ActionForm for this, but you do need a
> JavaBean to hold the data you want to display. To display it on the
> page,
> use JSTL <c:out ...> tags.
> 
> --
> Tim Slattery
> [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

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

Reply via email to