You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tim Sawyer <ts...@nildram.co.uk> on 2002/02/25 16:41:24 UTC
Form Bean problem
Hello.
I'm calling a JSP page as the successful outcome of an action, and it's complaining that one of my get methods doesn't exist. I can't work out what's going on, can someone give me a nudge in the right direction?
The page contains a form, for entering date of birth and marital status (for now, I'm still messing with a test project). If I define no form bean for this action, I get an error saying it can't find the getter method. If I define the form bean and leave the Validate() method checking for nulls, I get validation errors (correctly). If I remove the validation code, then I get the getter method not found error again. Surely I shouldn't have to define the form bean at all?
Is there any reference to the flow of methods called between a call to a do and displaying a success JSP anywhere?
--------------Action Mapping------------------------------------------
<action path="/callExtraPersonDetails"
type="com.pancredit.tkbespoke.tjs.strutstest.action.AddExtraPersonDetailsPreAction"
name="addExtraPersonDetailsForm"
scope="session"
input="/AddFindParty/FindPartyResults.jsp">
<forward name="success" path="/ExtraCustomerDetails.jsp"/>
----------------ExtraCustomerDetails.JSP ------------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<head>
<title>Untitled Document</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Please enter the following customer details: </p>
<html:errors/>
<html:form action="/saveExtraPersonDetails.do" focus="maritalStatusID">
<table width="39%" border="0">
<tr>
<td width="24%">Date of Birth:</td>
<td width="76%">
<html:text property="dob" size="30"/>
</td>
<td width="24%">Marital status:</td>
<td width="76%">
<html:text property="maritalStatusID" size="30"/>
</td>
</tr>
<tr>
<td width="24%"> </td>
<td width="76%">
<html:submit>
<bean:message key="button.submit"/>
</html:submit>
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
</td>
</tr>
</table>
</html:form>
<p> </p>
</body>
</html:html>
-----------------Form Bean----------------------------------------------------------------------
public class AddExtraPersonDetailsForm extends AbstractActionForm
{
private String dob = null;
private String maritalStatusID = null;
/** Creates a new instance of Class */
public AddExtraPersonDetailsForm()
{
}
/** Getter for property maritalStatusID.
* @return Value of property maritalStatusID.
*/
public java.lang.String getMaritalStatusID()
{
return maritalStatusID;
}
/** Setter for property maritalStatusID.
* @param maritalStatusID New value of property maritalStatusID.
*/
public void setMaritalStatusID(java.lang.String maritalStatusID)
{
this.maritalStatusID = maritalStatusID;
}
/** This method is called when the user submits the form. It should validate the
* data that has been entered for mandatory variables etc.
*/
protected ActionErrors onValidate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors lErrors = new ActionErrors();
// this.checkMandatory(lErrors, this.dob, "dob", "addFindPartyModule.errors.dobMissing");
// this.checkMandatory(lErrors, this.maritalStatusID, "maritalStatusID", "addFindPartyModule.errors.maritalStatusIDMissing");
return lErrors;
}
/** This method is called when the user pushes the Reset button on the form.
* It should assign all of the fields on the form null.
*/
protected void onReset(ActionMapping mapping, HttpServletRequest request)
{
// this.dob = null;
// this.maritalStatusID = null;
}
/** Getter for property dob.
* @return Value of property dob.
*/
public java.lang.String getDob()
{
return dob;
}
/** Setter for property dob.
* @param dob New value of property dob.
*/
public void setDob(java.lang.String dob)
{
this.dob = dob;
}
--------------Top of Error stack--------------------------------------------------------------
javax.servlet.jsp.JspException: No getter method for property dob of bean org.apache.struts.taglib.html.BEAN
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517)
at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:188)
at /ExtraCustomerDetails.jsp._jspService(/ExtraCustomerDetails.jsp.java:70) (JSP page line 17)
at com.orionserver[Orion/1.5.2 (build 10460)].http.OrionHttpJspPage.service(Unknown Source)
cheers,
Tim.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>