× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Nathan-

Would it be too much to assume that the List could be referenced directly
from JSPs and more specifically from JSF tags? Would the List be suitable for
consumption by the "presentation layer"?

Your assumptions are correct.
The DAO class I wrote could be directly consumed by the presentation
layer or from a business layer, or both.

In Java code you would use the DAO as follows:

RegistrationDaoImpl regDAO = new RegistrationDaoImpl();

List myList = regDAO.retrieveRegistrations();

// If list is not empty, print it out.
for(int i =0; i< myList.size(); i++){
Map current = myList.get(i);
System.out.println("First Name: " + current.get("FIRST_NAME") );
System.out.println("Last Name: " + current.get("LAST_NAME") );

}


JSP taglibs, JSF, Struts and other presentation frameworks can easily
deal with maps and lists. Notice there is no mention of Spring APIs or
JDBC APIs outside the dao implemetation class. So I could easily
switch to another mechanism without touching business logic or
presentation logic. Or I could use a different mechanism ( such as
LDAP) in different DAO implemtations.

On a side note, there are optional integrations between Spring IoC and
many presentation frameworks. So when I use Spring IoC I can eliminate
the line of code that calls the DAO constructor. ( RegistrationDaoImpl
regDAO = new RegistrationDaoImpl(); )

-Sarah


-Sarah


On Mon, Jul 7, 2008 at 6:43 PM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:
Thanks, Sarah. Your example of a retrieveRegistrations() method offers a good illustration of building a collection of rows and columns from an SQL result set. Would it be too much to assume that the List could be referenced directly from JSPs and more specifically from JSF tags? Would the List be suitable for consumption by the "presentation layer"? At this point you've only characterized it as a Data Access Object.

Nathan.




----- Original Message ----
From: Sarah Poger Gladstone <listmember@xxxxxxxxxxxxxx>
To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
Sent: Monday, July 7, 2008 4:19:35 PM
Subject: Re: [WEB400] Mapping SQL Result Sets to Browsers

Nathan - Below I have pasted a method for my DAO example that shows an
example of a multi-row, multi-column result from a query:

public List retrieveRegistrations(){
List reg_list = null;
reg_list = getSimpleJdbcTemplate().queryForList( "Select * from PERSON" );
return reg_list;
}


If there are 3 records each with 2 columns, then the list returned
will look like:

List{
0 - Map {FIRST_NAME= "Sarah", LAST_NAME="Gladstone"}
1 - Map {FIRST_NAME= "Simone", LAST_NAME="Gladstone"}
2 - Map {FIRST_NAME= "John", LAST_NAME="Doe"}



--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.