aspose file tools*
The moose likes Struts and the fly likes  No getter method for property: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark " No getter method for property: "cust_id" of bean: "com.myapp. struts.RegActionForm"" Watch " No getter method for property: "cust_id" of bean: "com.myapp. struts.RegActionForm"" New topic
Author

No getter method for property: "cust_id" of bean: "com.myapp. struts.RegActionForm"

Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 201

hello friends,

i am getting frustrated by this error.
actually i had one jsp page,on which there are already some fields present.
for which there was a getter and setter methods and validations in the actionformbean.
there these many fields earlier.
<table border="1" align="center">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><bean:message key="cust_reg.name" /></td>
<td><html:text property="name" /></td>
</tr>
<tr>
<td><bean:message key="cust_reg.address"/></td>
<td><html:textarea property="address"/></td>
</tr>
<tr>
<td><bean:message key="cust_reg.city"/></td>
<td><html:text property="city"/></td>
</tr>
<tr>
<td><bean:message key="cust_reg.pincode"/></td>
<td><html:text property="pincode"/></td>
</tr>
<tr>
<td><bean:message key="cust_reg.person"/></td>
<td><html:text property="person"/></td>
</tr>
<tr>
<td><bean:message key="cust_reg.designation"/></td>
<td><html:text property="designation"/></td>
</tr>

<tr>
<td><html:submit value="next" /></td>
<td><html:reset/>

</tr>
</tbody>
</table>
<html:errors />

</html:form>
</body>
</html>


later on i wanted to add one more field
<tr>
<td><bean:message key="cust_reg.cust_id"/></td>
<td><html:text property="cust_id"/></td>
</tr>
to the same form.

on my actionformbean,there were getters and setters methods and the validate method for each of the above mentioned fields.

the one for cust_id i added later.

package com.myapp.struts;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
*
* @author Administrator
* @version
*/

public class RegActionForm extends org.apache.struts.action.ActionForm {
private String cust_id;
private String name;
private String address;
private String person;
private String city;
private String designation;
private String pincode;

/**
* @return
*/


public String getCust_ID(){
return cust_id;
}

public String getName(){
return name;
}
public String getAddress(){
return address;
}
public String getPincode(){
return pincode;
}
public String getPerson(){
return person;
}
public String getCity(){
return city;
}
public String getDesignation(){
return designation;
}
public void setCust_ID(String Cust_ID ){
cust_id=Cust_ID;
}
public void setName(String string) {
name = string;
}

public void setAddress(String Address){
address = Address;
}
public void setPincode(String Pincode){
pincode = Pincode;
}
public void setPerson(String Person){
person = Person;
}
public void setCity(String City){
city = City;
}
public void setDesignation(String Designation){
designation = Designation;
}
public boolean isNumeric( String test_string ) {
try {
Integer.parseInt(test_string);
return true;
} catch ( Exception e ) {
return false;
}
}






public RegActionForm() {
super();
// TODO Auto-generated constructor stub
}

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if((getCust_ID()==null||getCust_ID().length()<1)||(getName() == null || getName().length() < 1)||(getAddress()== null || getAddress().length()<1) || (getCity() == null || getCity().length()<1)||(getPerson()==null||getPerson().length()<1)||(getDesignation()==null||getDesignation().length()<1)||(getPincode()==null||getPincode().length()<1)) {
errors.add("name", new ActionMessage("error.name.required"));
}
if (isNumeric(getPincode())== false) {
errors.add("pincode",new ActionMessage("error.pincode.required"));
}
return errors;
}
}


I also added the corresponding field in the application Resource file,as
cust_reg.cust_id=cust_id


after doing all this when i tried to run, my project, i am getting the errors.

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache. jasper.JasperException: Exception in JSP: /Cust_Reg.jsp:37

34: <tbody>
35: <tr>
36: <td><bean:message key="cust_reg.cust_id"/></td>
37: <td><html:text property="cust_id"/></td>
38: </tr>
39: <tr>
40: <td><bean:message key="cust_reg.name" /></td>



root cause

javax.servlet. ServletException: No getter method for property: "cust_id" of bean: "com.myapp. struts.RegActionForm"

root cause

javax.servlet. jsp.JspException: No getter method for property: "cust_id" of bean: "com.myapp. struts.RegActionForm"


please help me to solve this problem.

-thanks and regards,
pankaj shet


PANKAJ SHET
B.Sc.(I.T.), S.C.J.P., S.C.W.C.D., PGDAC(CDAC)
Shilpa Tendulkar
Ranch Hand

Joined: Jul 29, 2001
Posts: 75
Please check the getter for cust_id, I think it should be getCust_id() instead of getCust_ID();


SCJP5
Pankaj Shet
Ranch Hand

Joined: Sep 08, 2006
Posts: 201

Thanks a lot,Shilpa!!! U were right.!!!I got the answer.!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No getter method for property: "cust_id" of bean: "com.myapp. struts.RegActionForm"
 
Similar Threads
Struts Validation Empty alert Box
how to iterate.
&gt;html:text &lt; default value
HTTP Status 500 -
Formatting the Errors