• 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

html:select tag - problem in struts

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone-

Struts appears to be appending _# to the property name on my <html:select> tags which is causing "No getter method..." errors. The property name is defined in my Form, and the only Form items that cause an arror are the ones used in html:select tags.

Have any of you ever run into this? Any solutions you used? Thanks! My SELECT code and the error messages are below.

<c:forEach var="liabilities" items="${scenarioForm.liabilities}" varStatus="status">
<html:select property="originalLender" name="liabilities" indexed="true" >
</c:choose>
<c:when test="${scenarioForm.leadChannel == '2'}">
<html ptions collection="ORIGINALLENDERADDCORR" property="value" labelProperty="label" >
</c:when>
<c therwise>
<html ptions collection="ORIGINALLENDER" property="value" labelProperty="label" >
</c therwise>
</c:choose>
</html:select>



ERROR 12:26:06 [http-8080-Processor23] [com.dfc.struts.framework.JSHelper] - No getter method for property originalLender_0 of bean liabilities
javax.servlet.jsp.JspException: No getter method for property originalLender_0 of bean liabilities
ERROR 12:26:06 [http-8080-Processor23] [com.dfc.struts.framework.JSHelper] - No getter method for property originalLender_1 of bean liabilities
javax.servlet.jsp.JspException: No getter method for property originalLender_1 of bean liabilities
ERROR 12:26:06 [http-8080-Processor23] [com.dfc.struts.framework.JSHelper] - No getter method for property originalLender_2 of bean liabilities
javax.servlet.jsp.JspException: No getter method for property originalLender_2 of bean liabilities
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First off I notice that the code that you posted has "</c:choose>" where it should be "<c:choose>".

It is hard to say what the cause of the error is without knowing more about your action form. Does your form have a method like getLiabilities(int i)?

- Brent
 
Kevin McLeod
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply! Yes, the following methods exist within the actionForm. All of the form's variables are being accessed and rendered properly by the jsp - even the field responsible for the error message. It is only the property of the <html:select> tag that is getting that _number appended, and I haven't been able to figure out why...


private List liabilities;
public List getLiabilities() {
return liabilities;
}
the class is initialized as follows:
liabilities = new FormList(ScenarioLiabilityDetailForm.class);

and here is part of the class containing the individual data items:
public class ScenarioLiabilityDetailForm extends BaseActionForm {
private String originalLender;
private String UPB;
private String UPBPD;
private String rentalWash;
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you specify indexed="true" on a Struts tag, you must provide an indexed getter to go with it. In addition to this, a requirement that is not well documented is that the name given to the "var" attribute of your <c:forEach> tag must match the name of this indexed getter. Due to the fact that ActionForms don't handle overloaded methods very well, that name also needs to be different from the name given to the getter for the collection.

Given the above, I'd suggest creating the following getter in your ActionForm.



Then change your jsp to:



Note: The ability to embed an indexed property in a <c:forEach> stanza was added with version 1.2 of struts, so this will only work if you are using version 1.2 or above. Otherwise, you must use a <logic:iterate> tag.
[ January 16, 2007: Message edited by: Merrill Higginson ]
reply
    Bookmark Topic Watch Topic
  • New Topic