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

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..
 
Could you hold this puppy for a sec? I need to adjust this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic