aspose file tools*
The moose likes Struts and the fly likes Error in populating a Option List from Collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error in populating a Option List from Collection" Watch "Error in populating a Option List from Collection" New topic
Author

Error in populating a Option List from Collection

Amol Gokhale
Greenhorn

Joined: Aug 03, 2003
Posts: 1
Hi,
I am trying to populate a Collection (Arralist of my DTO object) in a drop down box but it is giving be some error as
org.apache.jasper.JasperException: No getter method available for property intDBID for bean under name DBList
This is my JSP Code in which I am trying to populate the collection
//JSP
<html:select property="intDBId">
<html ption value="0">Select a Dashboard</html ption>
<html ptions collection ="DBList" property= "intDBID" labelProperty ="strDBName"/>
</html:select>
//Action Class
public ActionForward execute (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{


DBActionForm objForm=(DBActionForm) form;

AdminHelper objAdmHelper=new AdminHelper();
// Helper class which returns arraylist of DTO Objects
// after fetching dta from database
ArrayList arlDB=objAdmHelper.getDBList();

request.setAttribute("DBList",arlDB);
return mapping.findForward("success");

}
//BEAN Class
public class DBActionForm extends ActionForm
{
private int intDBId = 0;
private String strDBName = null;


public int getIntDBId() {
return intDBId;
}

public void setIntDBId(int intDBId) {
this.intDBId = intDBId;
}

public String getStrDBName() {
return strDBName;
}
public void setStrDBName(String strDBName) {
this.strDBName = strDBName;
}
};
// DTO Class
public class DBDTO implements Serializable, Cloneable {
// Member variables
private int intDBId= 0;
private String strDBName = null;

public DBDTO() { }
public int getIntDBId(){
return this.intDBId;
}
public void setIntDBId(int nDBId) {
this.intDBId = nDBId;
}
public String getStrDBName(){
return this.strDBName;
}
public void setStrDBName(String strDBName) {
this.strDBName = strDBName;
}
};
Still when i try to access the page it is giving this Error I donno what is wrong with this.
Please help me i am a new to struts
Thanks
Amol....intDBIDDBList
Afifa Habchi
Greenhorn

Joined: Aug 06, 2003
Posts: 3

[ August 06, 2003: Message edited by: Afifa Habchi ]
Afifa Habchi
Greenhorn

Joined: Aug 06, 2003
Posts: 3
Hello, You have to write all properties like this:
property= intDBId not intDBID
in your FormBean you have the method getIntDBId=> you have to take the Suffix intDBId without get,and the firt i musst be i not I.

This muss be made for all get and Set methods.
Afifa
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error in populating a Option List from Collection