TalentDAO Interface
package oracle.support.au.dao;
import java.util.List;
import oracle.support.au.dao.beans.Manager;
public interface TalentDAO
{
public List<Manager> retrieveManagerList() throws TalentException;
.....
TalentDAOImpl Class
package oracle.support.au.dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.support.au.dao.beans.Manager;
public class TalentDAOImpl implements TalentDAO
{
// Use JDK Logging
private static Logger logger = Logger.getLogger("talentlogging");
public List<Manager> retrieveManagerList() throws TalentException
{
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
List<Manager> mgrs = null;
conn = TalentUtil.getDataSourceConnection();
try
{
stmt = conn.createStatement();
rset = stmt.executeQuery(Constants.ALL_MANAGERS);
mgrs = TalentUtil.makeManagerListFromResultSet(rset);
}
catch (SQLException se)
{
logger.log
(Level.SEVERE,
"** TALENT (TalentDAOImpl.retrieveManagerList() : " +
se.getMessage());
throw new TalentException(se);
}
finally
{
// close all resources
JDBCUtil.close(rset, stmt, conn);
}
return mgrs;
}
.....
1. Right click on my DAO Implementation class and select "Create Data Control"
2. Open up my Struts Page Flow diagram
3. Drag and Drop a "Data Page" onto the diagram
4. Double click on the Data Page icon and create your JSP page.
5. Open up the "Data Control Palette"
6. Drag the the "Result" of the method retrieveManagerList() onto the Visual Editor and select "Tables -> Read Only Table".
That's all you need to do here and the Manager bean which is simply a java class with getter/setters for each property is what is in the actual return list which we clearly specify by the method signature. ADF data binding will then do it's magic to expose the return List of Managers to the UI at runtime without having to write any code to setup the bindings.
public List<Manager> retrieveManagerList() throws TalentException
Be sure to run the Data Page itself and not the JSP page to see the return results in a table.