If you are also the bean provider, you could add an additional bean field called 
something like "all" and in its "setAll() call, initialize all of the particular 
fields you wish to. This may be more efficient than reinstanciating your bean....

John Zerbe - Mellon Financial Corp.
Information Technology Solutions - Middleware Team
Phone:  412-234-1048   E-Mail:[EMAIL PROTECTED]
AIM: 153-1315




-----Original Message-----
From: Michael Rosenstein [mailto:[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 10:56 AM
To: [EMAIL PROTECTED]
Subject: Re: JSP:Setproperty and empty strings


>I have a bean on a page, and the user may remove the value of an attribute
>by using the delete key to remove the contents of a pre-populated text
>box. On the following page we use <jsp:setProperty...property="*"> or
><jsp:setProperty...property="firstName"> to set all the values. This works
>fine for everything apart from empty strings.

The approach I took to solving the same problem is to remove my
session-scope bean and then re-instantiate it:

<%
  session.removeAttribute("sRefQueryTerms");
%>
<jsp:useBean id="sRefQueryTerms" scope="session"
class="org.mdibl.ctd.jsp.beans.RefQueryTermsBean" />
<jsp:setProperty name="sRefQueryTerms" property="*" />

I don't know how (in)efficient this is, but it didn't sound any worse than
doing 15 setProperty calls setting strings to null (or "").

/mcr

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com


DISCLAIMER:
The information contained in this e-mail may be confidential and is intended solely 
for the use of the named addressee. Access, copying or re-use of the e-mail or any 
information contained therein by any other person is not authorized. If you are not 
the intended recipient please notify us immediately by returning the e-mail to the 
originator.

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to