• 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

No getter method available

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am writing an application, which uses struts and hibernate. when i try to retreive the values from bean, i get the following error:
E SRVE0026E: [Servlet Error]-[No getter method for property agentName of bean aMEnrollment]

The following is the code iam using...

struts-config.xml:
- the relevant form definition
<form-bean name="AMEnrollmentForm" type="com.abc.forms.AMEnrollmentForm" />
- the relevant action mapping
<action path="/AMEnrollment" type="com.abc.actions.AMEnrollmentAction">
<forward name="success" path="/jsp/am_enrollment.jsp" />
</action>


Java code:

- relevant snippets from action class

query = session.createQuery("from com.abc.entities.Agent " + params);
results= query.list();
request.setAttribute("aMEnrollments", results);


JSP:

-<jsp:useBean id="aMEnrollments" type="java.util.List" scope="request"/>
<logic:iterate id="aMEnrollment" name="aMEnrollments" scope="request" >
<td><bean:write name="aMEnrollment" property="agentName" /></td>

stacktrace:

E SRVE0026E: [Servlet Error]-[No getter method for property agentName of bean aMEnrollment]: javax.servlet.jsp.JspException: No getter method for property agentName of bean aMEnrollment
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:973)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:225)

Please help me.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The name attribute in action mapping is missing which relates to the form bean it uses it should be like this.

struts-config.xml:
- the relevant form definition
<form-bean name="AMEnrollmentForm" type="com.abc.forms.AMEnrollmentForm" />
- the relevant action mapping
<action path="/AMEnrollment" name="AMEnrollmentForm" type="com.abc.actions.AMEnrollmentAction">
<forward name="success" path="/jsp/am_enrollment.jsp" />
</action>
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
form-bean definition is NOT required for an action-mapping and in this case, it's irrelevant to the problem.

you need to expose the full Java type of the individual enrollment bean via the 'type' attribute of the logic:iterate tag (see http://struts.apache.org/userGuide/struts-logic.html#iterate). also, make sure you have the 'agentName' field defined along with the corresponding getter and setter.
reply
    Bookmark Topic Watch Topic
  • New Topic