• 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

javax. servlet .ServletException: No getter method

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am designing a web application using Struts 1.0.2 and Tomcat 3.3.1. The main idea is that a user goes to the first page and enters a couple values to search. A list of matching results is then returned, and the user can choose a result to see the full match. My action has no problem connecting the database, finding the values, and populating them in an ArrayList. I am having a lot of difficulty iteratoring the object in the jsp.
This is the part of the JSP that causes the error:
<logic:iterate id="initialqueryresult"
name="results"
scope="request"
type="package.name.InitialQueryResult">
<bean:write name="initialqueryresult" property="idnumber" />
This returns the error:
javax.servlet.ServletException: No getter method for property idnumber of bean results
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
The bean is part of the InitialQueryResult object which has get/set methods for all the beans. I forward this object to the results.jsp in the Action from the login page with this code:
//getResults returns ArrayList of InitialQueryResult objects
results = getResults(idnumber, firstname, lastname);
//cut out failure forward check
request.setAttribute("results", results);
return (mapping.findForward(target));
If anyone has any ideas, help would be appreciated.
 
Eric Hauser
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm also using the following:
<logic:notPresent name="results">
<logic:forward name="index" />
</logic:notPresent>
to make sure that the results are being sent to the JSP.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will assume that your last code snippet actually forwards the request to a different page when the "results" are not in the request. Otherwise it seems to me that idnumber is in fact not being set in the class specified.
If your getter and setter methods use "getIDNumber" and "setIDNumber", you must keep the capital letters in the property (this only seems true if there is more than one capital letter that follows the get/set). Try specifying propery="IDNumber" in your bean tag. The only time this error appears is when Struts cannot find the getter or setter for a particular property. And 99% of the time, it's a spelling or reflection issue.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic