You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thomas Praschl <pr...@hackhofer.com> on 2002/07/23 14:03:00 UTC

problem with ActionForm object

Hi,
I have a simple form on my jsp page. In my ActionForm class I validate whether a checkbox was clicked or not. If the checkbox was not clicked an error is returned and displayed on the same jsp-page. This works fine but:
Some (not all!) of the properties which were given by the user are not available on the error page. 
Furthermore, before I first show the jsp-form I get some information from a database which is then stored in the ActionForm bean and therefore displayed in a selectbox. After submitting the form and after validation this information is not available on the error jsp-page. It seems that the ActionForm object was destroyed too early.

Does anyone have any ideas about this problem?

Thanks

-----------------------------------------------------------------------------------------------------------------------------
Thomas
praschl@hackhofer.com

Re: problem with ActionForm object

Posted by Thomas Praschl <pr...@hackhofer.com>.
This is the select box tag on the jsp page:
<html:select property="ewrStaaten">
<html:options property="ewrStaatenValue" labelProperty="ewrStaatenLabel"/>
</html:select>

These are the getter and setter methods in the ActionForm class:

   public String getEwrStaaten() {
      return (ewrStaaten);
   }
   public void setEwrStaaten(String ewrStaaten) {
      this.ewrStaaten = ewrStaaten;
   }
   public Vector getEwrStaatenLabel() {
      return (ewrStaatenLabel);
   }
   public void setEwrStaatenLabel(Vector ewrStaatenLabel) {
      this.ewrStaatenLabel = ewrStaatenLabel;
   }
   public Vector getEwrStaatenValue() {
      return (ewrStaatenValue);
   }
   public void setEwrStaatenValue(Vector ewrStaatenValue) {
      this.ewrStaatenValue = ewrStaatenValue;
   }

These things work fine because on when the jsp page is first requested the
select box properties are displayed. But the second time this page is
displayed (after validate() - when the error occurs!) the property
Vector ewrStaatenLabel is not displayed and obviously not available in the
ActionForm object.

----------------------------------------------------------------------------
-----------------------------------------Thomas
praschl@hackhofer.com



----- Original Message -----
From: "Jean-Baptiste Onofré" <jb...@phpfr.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, July 23, 2002 2:15 PM
Subject: Re: problem with ActionForm object


>
> Your ActionForm contains all accessors to the fields of html form ? For
> exemple, if you have a text field name "things", you must have a
> attributes String things in your ActionForm.
>
> Do you use the tag <html:form> or directly the html <form> tag ?
>
> --
> Jean-Baptiste Onofré (Nanthrax)
> Membre fondateur de phpFR.org
> http://www.phpfr.org
> jbonofre@phpfr.org
> Membre fondateur du LUG Béziers
> http://lug-beziers.org
> jbonofre@lug-beziers.org
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem with ActionForm object

Posted by Jean-Baptiste Onofré <jb...@phpfr.org>.
Your ActionForm contains all accessors to the fields of html form ? For
exemple, if you have a text field name "things", you must have a
attributes String things in your ActionForm.

Do you use the tag <html:form> or directly the html <form> tag ?

-- 
Jean-Baptiste Onofré (Nanthrax)
Membre fondateur de phpFR.org
http://www.phpfr.org
jbonofre@phpfr.org
Membre fondateur du LUG Béziers
http://lug-beziers.org
jbonofre@lug-beziers.org

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>