Can you change the value of the that field at submission with
javascript, to a 'default' value which can be considered a flag to the
setter method in the bean.  I do that in order to by pass getting a null
value in my bean which then calls an ejb. In the ejb, if the value is
the 'default' I reassingn the variable. Maybe this will inspire a solution?

public void setVariable(String value){

this.variable = (value.equals("default")) ? "" : value;

}

Brian P Bohnet

Does this work.
Tim Davidson wrote:

Different JSPs edit different fields from the bean, so we would have to write a setAll() method for each page to set only the fields for each particular page. This means moving presentation code into the bean, which is not something we wish to do. Becides this is just moving the '15 setProperty calls setting strings to ""' approach into the bean.

-----Original Message-----
From: Zerbe John W [mailto:[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 4:21 PM
To: [EMAIL PROTECTED]
Subject: Re: JSP:Setproperty and empty strings


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

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