PreparedStatement stmt = null;
ResultSet rs = null;
Integer offset = (Integer)parameters[1].getValue();
Integer length = (Integer)parameters[2].getValue();
int total = 0;
CachedRowSet crs = new CachedRowSet();
Slide slide = new Slide( length.intValue(),
offset.intValue(), new RowSetIterator( crs ) );
RowSetFactoryMapping factoryMapping= ( RowSetFactoryMapping )getFactoryMapping();
String dataSourceName = factoryMapping.getDataSource();
DataSource dataSource = ((ServletServiceManager)getFactoryService().getServiceManager()).getStrutsDataSource( dataSourceName );
if( dataSource==null )
throw new ServletException( "DataSource '" +
dataSourceName + "' not found!");
try {
conn = dataSource.getConnection();
stmt = conn.prepareStatement( (String)parameters[0].getValue() );
stmt.setMaxRows( slide.getOffset() + slide.getSlideLength() );
for( int i = 3; i < parameters.length; i++ ) {
stmt.setObject( i + 1, parameters[i].getValue() );
}
rs = stmt.executeQuery();
for( int i = 0; i < slide.getOffset() - 1; i++, total++ ) rs.next();
crs.populate( rs );
rs.close();
stmt.close();