• 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

Problem with html:select

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am a beginner to Struts. My task is to populate a list box. The values to be populated are obtained from database.

My code in JSP looks like this

<tr class = "BodyText">
<td width = "20%" ><bean:message key= "label.transactions.6KL.costCenterNo"/></td>
<td width = "20%"><logic:notEmpty name = "CtrctTxnForm" property="listContractorNo">
<html:select name = "CtrctTxnForm" property="costCenterNo" >
<html ption value="null" ><bean:message key="label.default.select" /></html ption>
<html ptionsCollection name = "CtrctTxnForm" property="listContractorNo" label="costCenterNo" value = "costCenterNo" />
</html:select>
</logic:notEmpty>
<logic:empty name="CtrctTxnForm" property="listContractorNo" >
<html:select name="CtrctTxnForm" property="costCenterNo" styleClass="POPText" >
<html ption value="null"><bean:message key="label.default.select" /></html ption>
</html:select>
</logic:empty>
</td>
</tr>


And the action is defined in struts-config.xml as follows :

<actionpath="/Ctrct6KL"
input = "/jsp/Contract/Ctrct6KL_Search.jsp"
type= "com.transactions.actions.CtrctAction"
name = "CtrctTxnForm"
scope = "session" >
<forward name="fail" path="/jsp/Contract/Ctrct6KL_Search.jsp" />
</action>


I get the following message when I try accessing the JSP:

No getter method found for property costCenterNo.

However I do have a form named CtrctTxnForm where in I have getter and setter method for property costCenterNo.

Guys please help me where am I going wrong.

Regards

Nikhil Bansal
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nikhil,
What kind of field is it? Can you show the snippet of your form containing the getters and setters?
 
Nikhil Bansal
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Foll is the snippet from Form.

public void setCostCenterNo(String costCenterNo){
logger.debug("CtrctTxnForm :: setCostCenterNo :: costCenterNo "+costCenterNo);
this.costCenterNo=costCenterNo;
}

public String getCostCenterNo(String costCenterNo){
logger.debug("CtrctTxnForm :: getContractorNo :: costCenterNo "+costCenterNo);
return costCenterNo;
}

Let me know if sth else is required from my end.

Regards

Nikhil Bansal
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because of this line:

costCenterNo must also be a property of whatever bean is exposed by iterating over the collection "listContractorNo". Does this bean have a getter/setter for costCenterNo?
[ September 18, 2006: Message edited by: Merrill Higginson ]
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic