Yeah, we considered this however the bean already contains objects which are not 
strings (dates and so on..) so we cant remove it from the session. If everything was a 
string in the bean you could put it in the form as a hidden value. This is a bit fo a 
nasty hack anyway. At the moment we are using the '15 setProperty calls setting 
strings to ""' approach! There must be another way?
Thanks anyway. I'm pleased to hear others have the same problem.

-----Original Message-----
From: Michael Rosenstein [mailto:[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 3:56 PM
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

==========================================================================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