example1/bean/TableViewBean.java
package example1.bean;
import java.util.Vector;
/**
* A bean used as databag to transport data from a servlet to the JSP. The bean contains a string
* that can be used as title/headline for the JSP and a vector that contains the
* data that should be displayed in the JSP in tabular form.
* The int values tableRows and tableColumns should be set to the actual dimension of the array.
* The JSP uses the two values to iterate.
*/
public class TableViewBean {
// name is used as title in the JSP
private String name;
// array for table
private Vector tableContent;
// variables that define the size of the array
private int tableColumns;
private int tableRows;
// get and set methods
public String getString() {
return this.name;
}
public void setString(String name) {
this.name = name;
}
public void setTableColumns(int columns) {
this.tableColumns = columns;
}
public void setTableRows(int rows) {
this.tableRows = rows;
}
public int getTableColumns() {
return this.tableColumns;
}
public int getTableRows() {
return this.tableRows;
}
public String getTableContent(int row, int column) {
Vector data = (Vector) tableContent.elementAt(row);
return data.elementAt(column).toString();
}
public Vector getTableContent() {
return tableContent;
}
public void setTableContent(Vector vector) {
tableContent = vector;
}
}