genericsyncexample1/bean/TableViewBean.java
package genericsyncexample1.bean;
/**
* 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 2 dimensional string array 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 String[][] 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)
{
return this.tableContent[row][column];
}
public void setTableContent (int row, int column, String content)
{
this.tableContent[row][column] = content;
}
}