struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dderry" <dde...@acm.org>
Subject Re: Form Bean problem
Date Mon, 25 Feb 2002 16:04:22 GMT
Do you have an Action Mapping for saveExtraPersonDetails.do? Does it use
also use addExtraPersonDetailsForm? Do you have a   <form-beans>
<form-bean      name="addExtraPersonDetailsForm"
type="package.addExtraPersonDetailsForm"/>.........</form-beans> entry in
struts-config.xml?

It appears to me that the addExtraPersonDetailsForm is not being used since
the error msg states that org.apache.struts.taglib.html.BEAN has no getter
method for dob.



----- Original Message -----
From: "Tim Sawyer" <tsawyer@nildram.co.uk>
To: <struts-user@jakarta.apache.org>
Sent: Monday, February 25, 2002 10:41 AM
Subject: 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.AddExtraPersonDetailsPre
Action"
>                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%">&nbsp;</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>&nbsp; </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:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message