• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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..
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic