What does your "usebean" tag look like?

-----Original Message-----
From: Tim Davidson [mailto:[EMAIL PROTECTED]
Sent: Friday, June 13, 2003 4:39 AM
To: [EMAIL PROTECTED]
Subject: Re: JSP:Setproperty and empty strings


Thanks for your answer but this doesnt work! The following lines have no affect on the 
bean:
        <jsp:setProperty name="myBean" property="firstName" value="<%=null%>"/>
        <jsp:setProperty name="myBean" property="firstName" value="<%=""%>"/>
        <jsp:setProperty name="myBean" property="firstName" value=""/>
Also:
        <jsp:setProperty name="myBean" property="*" value=""/>
or
        <jsp:setProperty name="myBean" property="*" value="<%=""%>"/>
causes:
        org.apache.jasper.JasperException: jsp.error.setProperty.invalid
Any other ideas?

-----Original Message-----
From: Hans Bergsten [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 12, 2003 5:25 PM
To: [EMAIL PROTECTED]
Subject: Re: JSP:Setproperty and empty strings


Tim Davidson wrote:
> yeah, the spec is unclear on this point. I have tried this and it doesnt have the 
> desired behaviour:
> <jsp:SetProperty name="RequestParmBean" property="inputfieldA" value=""/>
> This will not set inputfieldA to an empty string.
> Does anyone know why they implemented it in this way?

I think it was for consistency with the auto-population model, i.e.,
when using property="*". But, the result is very confusing, I agree.

This should work, though, since a request-time attribute value is
used as-is:

   <jsp:setProperty name="RequestParmBean" property="inputfieldA"
     value='<%= "" ' />

or to set it to null:

   <jsp:setProperty name="RequestParmBean" property="inputfieldA"
     value='<%= null ' />

Messy ... An alternative is to use JSTL's <c:set>:

   <c:set target="${RequestParmBean}" property="inputfieldA"
     value="" />

Hans

> -----Original Message-----
> From: Zerbe John W [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 12, 2003 4:48 PM
> To: [EMAIL PROTECTED]
> Subject: Re: JSP:Setproperty and empty strings
>
>
> If I am reading the spec correctly, you can initialize all of your properties 
> individually prior to setting them from the request params. I believe that the line 
> you quoted from the spec only applies when setting properties from request params.
>
> eg:
> <jsp:SetProperty name="RequestParmBean" property="inputfieldA" value=""/>
> <jsp:SetProperty name="RequestParmBean" property="inputfieldA" param="inputfieldA"/>
>
> or, assuming an input form the "inputfieldA" and "inputfieldB":
> <jsp:SetProperty name="RequestParmBean" property="inputfieldA" value=""/>
> <jsp:SetProperty name="RequestParmBean" property="inputfieldB" value=""/>
> <jsp:SetProperty name="RequestParmBean" property="*"/>
>
>
> -----Original Message-----
> From: Tim Davidson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 12, 2003 9:30 AM
> To: [EMAIL PROTECTED]
> Subject: JSP:Setproperty and empty strings
>
>
> Hi
>
>  Using <jsp:setProperty...> is is possbible to set empty strings? and if so how?
>
>  I realise the spec says:
>   "If the parameter has an empty or null value, the corresponding Bean property is 
> not set. "
>
>   but can anyone reccommend a fix?
>
> thanks in advance.
>
> =========================
> 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.
>
>
> 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
>

--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.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


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