• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Do not know why struts show "No getter method available for property ..." occasionally.

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Do not know why struts show the following error message occasionally. Please help, thank in advance!!

Error message
------------------
javax.servlet.ServletException: No getter method available for property schoolLevelIdList for bean under name null

struts-config.xml
-------------------
<action path="/jsp/Import"
type="websams.web.ExportAction"
name="exportForm"
scope="request">
<forward name="ok" path="/jsp/export.jsp"/>
</action>

<form-bean name="exportForm"
type="websams.web.ExportForm"/>


ExportForm.java
---------------
public ExportForm {
private ArrayList schoolLevelIdList = new ArrayList();

public ArrayList getSchoolLevelIdList() {
return schoolLevelIdList;
}

public void setSchoolLevelIdList(ArrayList schoolLevelIdList) {
this.schoolLevelIdList = schoolLevelIdList;
}

public void setSchoolLevelIdList(String schoolLevelId)
{
schoolLevelIdList.add(schoolLevelId);
}

public String getSchoolLevelIdList(int aIndex)
{
while (this.schoolLevelIdList.size() <= aIndex)
{
this.schoolLevelIdList.add("");
}
return (String) schoolLevelIdList.get(aIndex);
}

}


export.jsp
----------
<jsp:useBean id="exportForm" class="websams.web.ExportForm" scope="request" />

schYear : <%=exportForm.getSchYear()%>

<html:select property="schLevel" onchange="changeSchoolLevel()">
<html:options labelProperty="schoolLevelEnDescList" property="schoolLevelIdList"/>
</html:select>

-----------

Thanks,
Jack
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello
1) I had something like your problem for getter with ArrayList as return type.
As remember, I have used SelectItem without problem. If you need list for select,
it is Ok to use SelectItem

2) Also I propose to rename public String getSchoolLevelIdList(int aIndex) to other name..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic