V
Vredevoort
Hi,
Who could help me with the following problem:
I´m having two java beans:GetAllCompanies and GetAllCompaniesRow
Now i would like to show some rows in a jsp page.
Who could show me how to do this?
Here are the two beans:
package Beandir;
import java.sql.*;
import com.ibm.db.beans.*;
/**
* This class sets the DBSelect property values. It also provides
* methods that execute your SQL statement, return
* a DBSelect reference, and return an array of objects
* representing the rows in the result set.
* Generated: Jan 16, 2006 9:08:16 PM
*/
public class GetAllCompanies {
private DBSelect select;
/**
* Constructor for a DBSelect class.
*/
public GetAllCompanies() {
super();
initializer();
}
/**
* Creates a DBSelect instance and initializes its properties.
*/
protected void initializer() {
select = new DBSelect();
try {
select.setDataSourceName("jdbc/kuipuh");
select.setCommand("SELECT * FROM VREDEVOORT.COMPANY");
} catch (SQLException ex) {
ex.printStackTrace();
}
}
/**
* Executes the SQL statement.
*/
public void execute(String userid, String password) throws SQLException
{
try {
select.setUsername(userid);
select.setPassword(password);
select.execute();
}
// Free resources of select object.
finally {
select.close();
}
}
/**
* Returns a DBSelect reference.
*/
public DBSelect getDBSelect() {
return select;
}
/**
* Returns an array of objects representing the rows in the result set.
*/
public GetAllCompaniesRow[] getRows() {
GetAllCompaniesRow[] rows =
new GetAllCompaniesRow[select.getRowCount()];
for (int i = 0; i <= select.getRowCount() - 1; i++) {
rows = new GetAllCompaniesRow(select, i + 1);
};
return rows;
}
}
package Beandir;
import java.sql.*;
import com.ibm.db.beans.*;
/**
* This class represents a specific row of a result set
* contained in a DBSelect.
* Generated: Jan 16, 2006 9:08:16 PM
*/
public class GetAllCompaniesRow {
private int rowNumber;
private DBSelect select;
/**
* Constructs an object that represents a row from a DBSelect.
*/
public GetAllCompaniesRow(DBSelect aRef, int aRowNumber) {
select = aRef;
rowNumber = aRowNumber;
}
/**
* Returns the value of column COMPANY_COUNTRY in the row represented by
this object.
*/
public Object getCOMPANY_COUNTRY() throws SQLException {
return select.getCacheValueAt(rowNumber, 1);
}
/**
* Returns the value of column COMPANY_STRATEGY in the row represented
by this object.
*/
public Object getCOMPANY_STRATEGY() throws SQLException {
return select.getCacheValueAt(rowNumber, 2);
}
/**
* Returns the value of column COMPANY_MAILING in the row represented by
this object.
*/
public Object getCOMPANY_MAILING() throws SQLException {
return select.getCacheValueAt(rowNumber, 3);
}
/**
* Returns the value of column COMPANY_REFERENT in the row represented
by this object.
*/
public Object getCOMPANY_REFERENT() throws SQLException {
return select.getCacheValueAt(rowNumber, 4);
}
/**
* Returns the value of column COMPANY_CONCURRENT in the row represented
by this object.
*/
public Object getCOMPANY_CONCURRENT() throws SQLException {
return select.getCacheValueAt(rowNumber, 5);
}
/**
* Returns the value of column COMPANY_MARKETING in the row represented
by this object.
*/
public Object getCOMPANY_MARKETING() throws SQLException {
return select.getCacheValueAt(rowNumber, 6);
}
/**
* Returns the value of column COMPANY_RELATIONBANKNR in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONBANKNR() throws SQLException {
return select.getCacheValueAt(rowNumber, 7);
}
/**
* Returns the value of column COMPANY_RELATIONPOSTBANKNR in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONPOSTBANKNR() throws SQLException {
return select.getCacheValueAt(rowNumber, 8);
}
/**
* Returns the value of column COMPANY_RELATIONNUMBER in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONNUMBER() throws SQLException {
return select.getCacheValueAt(rowNumber, 9);
}
/**
* Returns the value of column COMPANY_VALUTA in the row represented by
this object.
*/
public Object getCOMPANY_VALUTA() throws SQLException {
return select.getCacheValueAt(rowNumber, 10);
}
/**
* Returns the value of column COMPANY_BETALINGSWIJZE in the row
represented by this object.
*/
public Object getCOMPANY_BETALINGSWIJZE() throws SQLException {
return select.getCacheValueAt(rowNumber, 11);
}
/**
* Returns the value of column COMPANY_RELATIONMANAGER in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONMANAGER() throws SQLException {
return select.getCacheValueAt(rowNumber, 12);
}
/**
* Returns the value of column COMPANY_RELATIONTYPE in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONTYPE() throws SQLException {
return select.getCacheValueAt(rowNumber, 13);
}
/**
* Returns the value of column COMPANY_WEBSITE in the row represented by
this object.
*/
public Object getCOMPANY_WEBSITE() throws SQLException {
return select.getCacheValueAt(rowNumber, 14);
}
/**
* Returns the value of column COMPANY_MAILADDRESS_1 in the row
represented by this object.
*/
public Object getCOMPANY_MAILADDRESS_1() throws SQLException {
return select.getCacheValueAt(rowNumber, 15);
}
/**
* Returns the value of column COMPANY_MAILADDRESS in the row
represented by this object.
*/
public Object getCOMPANY_MAILADDRESS() throws SQLException {
return select.getCacheValueAt(rowNumber, 16);
}
/**
* Returns the value of column COMPANY_OFFICEFAXPHONENUMBER in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEFAXPHONENUMBER() throws SQLException {
return select.getCacheValueAt(rowNumber, 17);
}
/**
* Returns the value of column COMPANY_OFFICEPHONENUMBER in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPHONENUMBER() throws SQLException {
return select.getCacheValueAt(rowNumber, 18);
}
/**
* Returns the value of column COMPANY_CATEGORY in the row represented
by this object.
*/
public Object getCOMPANY_CATEGORY() throws SQLException {
return select.getCacheValueAt(rowNumber, 19);
}
/**
* Returns the value of column COMPANY_OFFICEPOCITY in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPOCITY() throws SQLException {
return select.getCacheValueAt(rowNumber, 20);
}
/**
* Returns the value of column COMPANY_OFFICEPOZIP in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPOZIP() throws SQLException {
return select.getCacheValueAt(rowNumber, 21);
}
/**
* Returns the value of column COMPANY_OFFICEPOADDRESS in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPOADDRESS() throws SQLException {
return select.getCacheValueAt(rowNumber, 22);
}
/**
* Returns the value of column COMPANY_OFFICECITY in the row represented
by this object.
*/
public Object getCOMPANY_OFFICECITY() throws SQLException {
return select.getCacheValueAt(rowNumber, 23);
}
/**
* Returns the value of column COMPANY_OFFICEZIP in the row represented
by this object.
*/
public Object getCOMPANY_OFFICEZIP() throws SQLException {
return select.getCacheValueAt(rowNumber, 24);
}
/**
* Returns the value of column COMPANY_OFFICESTREETADDRESS in the row
represented by this object.
*/
public Object getCOMPANY_OFFICESTREETADDRESS() throws SQLException {
return select.getCacheValueAt(rowNumber, 25);
}
/**
* Returns the value of column COMPANY_COMPANYNAME in the row
represented by this object.
*/
public Object getCOMPANY_COMPANYNAME() throws SQLException {
return select.getCacheValueAt(rowNumber, 26);
}
/**
* Returns a String that contains all of the values in the row
represented by this object.
*/
public String toString() {
String string = "";
try {
for (int i = 1; i <= select.getColumnCount(); i++) {
string += select.getCacheValueAt(rowNumber, i);
string += " ";
}
} catch (SQLException ex) {
return null;
}
return string;
}
}
Who could help me with the following problem:
I´m having two java beans:GetAllCompanies and GetAllCompaniesRow
Now i would like to show some rows in a jsp page.
Who could show me how to do this?
Here are the two beans:
package Beandir;
import java.sql.*;
import com.ibm.db.beans.*;
/**
* This class sets the DBSelect property values. It also provides
* methods that execute your SQL statement, return
* a DBSelect reference, and return an array of objects
* representing the rows in the result set.
* Generated: Jan 16, 2006 9:08:16 PM
*/
public class GetAllCompanies {
private DBSelect select;
/**
* Constructor for a DBSelect class.
*/
public GetAllCompanies() {
super();
initializer();
}
/**
* Creates a DBSelect instance and initializes its properties.
*/
protected void initializer() {
select = new DBSelect();
try {
select.setDataSourceName("jdbc/kuipuh");
select.setCommand("SELECT * FROM VREDEVOORT.COMPANY");
} catch (SQLException ex) {
ex.printStackTrace();
}
}
/**
* Executes the SQL statement.
*/
public void execute(String userid, String password) throws SQLException
{
try {
select.setUsername(userid);
select.setPassword(password);
select.execute();
}
// Free resources of select object.
finally {
select.close();
}
}
/**
* Returns a DBSelect reference.
*/
public DBSelect getDBSelect() {
return select;
}
/**
* Returns an array of objects representing the rows in the result set.
*/
public GetAllCompaniesRow[] getRows() {
GetAllCompaniesRow[] rows =
new GetAllCompaniesRow[select.getRowCount()];
for (int i = 0; i <= select.getRowCount() - 1; i++) {
rows = new GetAllCompaniesRow(select, i + 1);
};
return rows;
}
}
package Beandir;
import java.sql.*;
import com.ibm.db.beans.*;
/**
* This class represents a specific row of a result set
* contained in a DBSelect.
* Generated: Jan 16, 2006 9:08:16 PM
*/
public class GetAllCompaniesRow {
private int rowNumber;
private DBSelect select;
/**
* Constructs an object that represents a row from a DBSelect.
*/
public GetAllCompaniesRow(DBSelect aRef, int aRowNumber) {
select = aRef;
rowNumber = aRowNumber;
}
/**
* Returns the value of column COMPANY_COUNTRY in the row represented by
this object.
*/
public Object getCOMPANY_COUNTRY() throws SQLException {
return select.getCacheValueAt(rowNumber, 1);
}
/**
* Returns the value of column COMPANY_STRATEGY in the row represented
by this object.
*/
public Object getCOMPANY_STRATEGY() throws SQLException {
return select.getCacheValueAt(rowNumber, 2);
}
/**
* Returns the value of column COMPANY_MAILING in the row represented by
this object.
*/
public Object getCOMPANY_MAILING() throws SQLException {
return select.getCacheValueAt(rowNumber, 3);
}
/**
* Returns the value of column COMPANY_REFERENT in the row represented
by this object.
*/
public Object getCOMPANY_REFERENT() throws SQLException {
return select.getCacheValueAt(rowNumber, 4);
}
/**
* Returns the value of column COMPANY_CONCURRENT in the row represented
by this object.
*/
public Object getCOMPANY_CONCURRENT() throws SQLException {
return select.getCacheValueAt(rowNumber, 5);
}
/**
* Returns the value of column COMPANY_MARKETING in the row represented
by this object.
*/
public Object getCOMPANY_MARKETING() throws SQLException {
return select.getCacheValueAt(rowNumber, 6);
}
/**
* Returns the value of column COMPANY_RELATIONBANKNR in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONBANKNR() throws SQLException {
return select.getCacheValueAt(rowNumber, 7);
}
/**
* Returns the value of column COMPANY_RELATIONPOSTBANKNR in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONPOSTBANKNR() throws SQLException {
return select.getCacheValueAt(rowNumber, 8);
}
/**
* Returns the value of column COMPANY_RELATIONNUMBER in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONNUMBER() throws SQLException {
return select.getCacheValueAt(rowNumber, 9);
}
/**
* Returns the value of column COMPANY_VALUTA in the row represented by
this object.
*/
public Object getCOMPANY_VALUTA() throws SQLException {
return select.getCacheValueAt(rowNumber, 10);
}
/**
* Returns the value of column COMPANY_BETALINGSWIJZE in the row
represented by this object.
*/
public Object getCOMPANY_BETALINGSWIJZE() throws SQLException {
return select.getCacheValueAt(rowNumber, 11);
}
/**
* Returns the value of column COMPANY_RELATIONMANAGER in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONMANAGER() throws SQLException {
return select.getCacheValueAt(rowNumber, 12);
}
/**
* Returns the value of column COMPANY_RELATIONTYPE in the row
represented by this object.
*/
public Object getCOMPANY_RELATIONTYPE() throws SQLException {
return select.getCacheValueAt(rowNumber, 13);
}
/**
* Returns the value of column COMPANY_WEBSITE in the row represented by
this object.
*/
public Object getCOMPANY_WEBSITE() throws SQLException {
return select.getCacheValueAt(rowNumber, 14);
}
/**
* Returns the value of column COMPANY_MAILADDRESS_1 in the row
represented by this object.
*/
public Object getCOMPANY_MAILADDRESS_1() throws SQLException {
return select.getCacheValueAt(rowNumber, 15);
}
/**
* Returns the value of column COMPANY_MAILADDRESS in the row
represented by this object.
*/
public Object getCOMPANY_MAILADDRESS() throws SQLException {
return select.getCacheValueAt(rowNumber, 16);
}
/**
* Returns the value of column COMPANY_OFFICEFAXPHONENUMBER in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEFAXPHONENUMBER() throws SQLException {
return select.getCacheValueAt(rowNumber, 17);
}
/**
* Returns the value of column COMPANY_OFFICEPHONENUMBER in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPHONENUMBER() throws SQLException {
return select.getCacheValueAt(rowNumber, 18);
}
/**
* Returns the value of column COMPANY_CATEGORY in the row represented
by this object.
*/
public Object getCOMPANY_CATEGORY() throws SQLException {
return select.getCacheValueAt(rowNumber, 19);
}
/**
* Returns the value of column COMPANY_OFFICEPOCITY in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPOCITY() throws SQLException {
return select.getCacheValueAt(rowNumber, 20);
}
/**
* Returns the value of column COMPANY_OFFICEPOZIP in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPOZIP() throws SQLException {
return select.getCacheValueAt(rowNumber, 21);
}
/**
* Returns the value of column COMPANY_OFFICEPOADDRESS in the row
represented by this object.
*/
public Object getCOMPANY_OFFICEPOADDRESS() throws SQLException {
return select.getCacheValueAt(rowNumber, 22);
}
/**
* Returns the value of column COMPANY_OFFICECITY in the row represented
by this object.
*/
public Object getCOMPANY_OFFICECITY() throws SQLException {
return select.getCacheValueAt(rowNumber, 23);
}
/**
* Returns the value of column COMPANY_OFFICEZIP in the row represented
by this object.
*/
public Object getCOMPANY_OFFICEZIP() throws SQLException {
return select.getCacheValueAt(rowNumber, 24);
}
/**
* Returns the value of column COMPANY_OFFICESTREETADDRESS in the row
represented by this object.
*/
public Object getCOMPANY_OFFICESTREETADDRESS() throws SQLException {
return select.getCacheValueAt(rowNumber, 25);
}
/**
* Returns the value of column COMPANY_COMPANYNAME in the row
represented by this object.
*/
public Object getCOMPANY_COMPANYNAME() throws SQLException {
return select.getCacheValueAt(rowNumber, 26);
}
/**
* Returns a String that contains all of the values in the row
represented by this object.
*/
public String toString() {
String string = "";
try {
for (int i = 1; i <= select.getColumnCount(); i++) {
string += select.getCacheValueAt(rowNumber, i);
string += " ";
}
} catch (SQLException ex) {
return null;
}
return string;
}
}