struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: DynaActionForm if not set condition
Date Wed, 26 Mar 2003 03:37:24 GMT


On Tue, 25 Mar 2003, Adam Sherman wrote:

> Date: Tue, 25 Mar 2003 20:50:39 -0500
> From: Adam Sherman <adam@tritus.ca>
> Reply-To: Struts Users Mailing List <struts-user@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: DynaActionForm if not set condition
>
> How do I check if a field hasn't been set at all?
>
> DynaActionForm.get("fieldName") == null, or
> DynaActionForm.get("fieldName") == ""
>

The first form will correctly check whether the field has been set to
anything or not.  The second will never work -- if you want to check for a
zero-length String, do this instead:

  "".equals((String) DynaActionForm.get("fieldName")

> doesn't seem to work.
>
> Any hints?
>
> A.
>

Craig

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


Mime
View raw message