M
Marcus Reiter
Hi, I got a Bean that represents a vector containing several Beans
containing
several attributes (mainly Strings).
How can I set / display those attributes?
I asked Google, but unforunately I can't find any fitting examples.
Maybe you could help.
( I am trying to solve this just by using jsp standard tags)
<jsp:useBean id="BeanName" class="packageName.BeanName"
scope="application"/>
<jsp:setProperty name="BeanName" property="vectorName" value="10"/>
<jsp:getProperty name="BeanName" property="vectorName"/>
<jsp:useBean id="IncludedBeanName" class="packageName.IncludedBeanName"
scope="application"/>
<jsp:getProperty name="vectorName" property="IncludedBeanName"/>
<jsp:getProperty name="IncludedBeanName" property="attributeName"/>
However, that doesn't work.
Here is the error it throws:
org.apache.jasper.JasperException: Can't find a method to write property
vectorNameof type 'java.util.Vector' in a bean of type
'packageName.BeanName'
Here is the java code of "BeanName.java":
private Vector vectorName= new Vector();
private dbConnection = new DbConnection();
public Vector getVectorName() {
return this.vectorName;
}
public void setVectorName(int attribute) {
this.vectorName= dbConnection .getBeanList(attribute);
}
Here is what happens in class "dbConnection.java":
Vector vectorName = new Vector();
while (rs.next()) {
beanName= new BeanName();
beanName.setAttribute1(rs.getInt(1)); // auslesen der
Attribute
beanName.setAttribute2(rs.getString(2) + " " +
rs.getString(3));
beanName.setsetAttribute3(rs.getInt(4));
beanName.setAttribute5(rs.getDate(5));
beanName.setAttribute6(rs.getString(6));
beanName.setAttribute7(rs.getString(7) + " " +
rs.getString(8));
vectorName .add(beanName);
}
Can you help?
Thanks,
Marcus
containing
several attributes (mainly Strings).
How can I set / display those attributes?
I asked Google, but unforunately I can't find any fitting examples.
Maybe you could help.
( I am trying to solve this just by using jsp standard tags)
<jsp:useBean id="BeanName" class="packageName.BeanName"
scope="application"/>
<jsp:setProperty name="BeanName" property="vectorName" value="10"/>
<jsp:getProperty name="BeanName" property="vectorName"/>
<jsp:useBean id="IncludedBeanName" class="packageName.IncludedBeanName"
scope="application"/>
<jsp:getProperty name="vectorName" property="IncludedBeanName"/>
<jsp:getProperty name="IncludedBeanName" property="attributeName"/>
However, that doesn't work.
Here is the error it throws:
org.apache.jasper.JasperException: Can't find a method to write property
vectorNameof type 'java.util.Vector' in a bean of type
'packageName.BeanName'
Here is the java code of "BeanName.java":
private Vector vectorName= new Vector();
private dbConnection = new DbConnection();
public Vector getVectorName() {
return this.vectorName;
}
public void setVectorName(int attribute) {
this.vectorName= dbConnection .getBeanList(attribute);
}
Here is what happens in class "dbConnection.java":
Vector vectorName = new Vector();
while (rs.next()) {
beanName= new BeanName();
beanName.setAttribute1(rs.getInt(1)); // auslesen der
Attribute
beanName.setAttribute2(rs.getString(2) + " " +
rs.getString(3));
beanName.setsetAttribute3(rs.getInt(4));
beanName.setAttribute5(rs.getDate(5));
beanName.setAttribute6(rs.getString(6));
beanName.setAttribute7(rs.getString(7) + " " +
rs.getString(8));
vectorName .add(beanName);
}
Can you help?
Thanks,
Marcus