struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: Struts1 forms with empty Strings
Date Fri, 29 Feb 2008 20:38:40 GMT
//easiest solution would be to set all the attribute default values to null
e.g.
public class TestFormBean extends ActionForm
{
    private String   stringProperty=null;
    private Object[] arrayProperty=null;

    public  String   getStringProperty()
   {
     return (stringProperty);
    }
    public  void   setStringProperty(String stringProperty)
    {
      this.stringProperty = stringProperty;
    }

    public  Object[] getArrayProperty()
   {
     return (arrayProperty);
    }
    public  void setArrayProperty(Object[] arrayProperty)
    {
      this.arrayProperty = arrayProperty;
    }
}

Anyone else?
M-
----- Original Message -----
From: "Andy" <andrhahn@hotmail.com>
To: <user@struts.apache.org>
Sent: Friday, February 29, 2008 1:58 PM
Subject: Struts1 forms with empty Strings


Hi,
I was wondering if there is a way to configure Struts1 so Form beans return
null values instead of empty String values when a user does not enter data
in a text field, for example.  The problem is that Hibernate then saves
empty Strings to the database instead of nulls.  I would like to configure
something globally if possible.
Thanks.. Andy


_________________________________________________________________
Helping your favorite cause is as easy as instant messaging. You IM, we
give.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join


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


Mime
View raw message