I am using ServletExec and I see the same behavior, even when I specify property name

<jsp:setProperty name="bean" property="propertyName" />

Looking at the source code I noticed that my set method in my bean is not being called 
at all
because of the spec specifies that if the field is an empty string "" the property 
does not get
changed.
So what about the following scenario.
If the field first returned some data (meaning at some point in the past the user 
filled data in) like in:

Cell Number: <INPUT TYPE="TEXT" NAME="cellNumber" VALUE="<%=bean.getCellNumber()%>" >

when the user cleared the attribute expecting it to delete it from the backend storage 
it will find that
the data is still there. This causes a lot of trouble because you can't use 
setProperty to set data in
your bean. To me that is VERY STUPID, I had to get the parameters from the request and 
pass them to the bean to
ensure that the method would be called and the field would get cleared.

Has anybody found a nicer way of doing that? As the amount of fields increases so does 
the jsp code to handle this.

Rene Muniz



On Fri, 11 Feb 2000 22:45:34 +0000, D. J. Hagberg <[EMAIL PROTECTED]> wrote:

>In section 2.13.2.1 of the JSP 1.0 specification where the syntax of
><jsp:setProperty name="x" property="y" param="z"/> is documented, the
>following appears:
>
>---------------------- snip -------------------------
>property
>
>The name of the Bean property whose value you want to set.
>
>If you set propertyName to * then the tag will iterate over the
>current ServletRequest parameters, matching parameter names
>and value type(s) to property names and setter method type(s), setting
>each matched property to the value of the matching parameter. If a
>parameter has a value of ""  , the corresponding property is not
>modified.
>---------------------- snip -------------------------
>
>I am confused by the last sentence in this spec (if a parameter has a
>value of "" [which I presume to mean the empty string], the
>corresponding property is not set).  This is apparently a changed
>behavior between JRun 2.3.3 build 155 and build 157.
>
>Does this rule only apply when property="*" or does it apply for ALL
>specified property names?  In other words, to pick up empty form
>elements do I simply need to break out my
>
><jsp:setProperty name="bean" property="*" />
>
>to
>
><jsp:setProperty name="bean" property="formElem1" />
><jsp:setProperty name="bean" property="formElem2" />
>. . .
>
>or do I need to write special code to handle form elements that the user
>could have deliberately (and reasonably) emptied out, such as the second
>line of an address?
>
>Thanks for any input...
>
>                        -=- D. J.
>
> ==========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
>FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to