Thanks but I know that already. I think you misunderstood my problem. 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.

 Since the parameters are in the URL (ie. ?firstName=&secondName= ) this problem could 
be solved. Surely others have encountered this problem and there is another solution 
other than writing my own <jsp:setProperty.. or by going through each attribute on the 
previous page and setting it to an empty string before calling setProperty?

 I looked at the code for the <jsp:setProperty..> tag and the empty string problem 
appears to be embedded in the JspRuntimeLibrary introspector.

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


you can't use property="*" with value=,
The property="*" expression tells the jsp compiler to generate code to use reflection 
to match up request params with bean fields.

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.


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

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