Hi Johan,

I always create a reset() method within beans to circumvent this problem. It
clears all fields that I don't want to hold any value during form
processing.

Mika

----- Original Message -----
From: "Johan Hoogenboezem" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 1:02 PM
Subject: preferred method of handling empty form fields


> Hi
> I use tomcat 3.2 on various platforms.
>
> My problem is this: when modifying a bean's properties through a jsp form,
I
> would like a property to be cleared if the corresponding form field is
> cleared. The introspect(...) method in the JspRuntimeLibrary does not do
> this for me.
>
> I searched the archives and found that according to the spec, if a request
> parameter has no value, then the corresponding bean property is not to be
> modified (see http://w4.metronet.com/~wjm/tomcat/2000/Jul/msg00481.html).
Oh
> well.
>
> That still leaves me the problem of handling empty fields. I could
> 1) Go through the list of request parameters myself and clear the
> corresponding bean properties if parameters have no value. This feels like
> duplicating some of what the introspectHelper(...) method does.
> 2) Use javascript to record all empty fields to a hidden field at submit
> time. This is rather cumbersome and requires a little extra code in the
form
> bean.
>
> I've used both but neither is very satisfying.
>
> So, to summarize, is there a preferred or recommended way of doing this
that
> anybody knows of?
>
> Thanks
> Johan Hoogenboezem
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to