Louis wrote:
>
> Hi,
> I'm using <jsp:setProperty name="cb" property="*" /> in my jsp page, so
> the user enter the data will automatically fill into
> the bean. But I got a problem, if the user do not enter anythings in the
> textfield, then the setProperty won't do anything, i.e
> if previously there is a data in the bean, and it won't replace to blank.
> ( I got this problem, because, for example if the user
> enter his email and goto next page, if he decide to remove his email, and he
> click back again and delete his email, but his
> email address still in the bean unless he enter a space in the email
> textfield.)
>
> Anyone know how to solve my problem.
>
> Thanks in advance
>
> Louis
You can reset the properties explicitly using the "value" attribute before
you set the new values based on request parameters, e.g.
<jsp:useBean id="foo" class="com.mycompany.MyBean" />
<jsp:setProperty name="foo" property="name" value="" />
<jsp:setProperty name="foo" property="email" value="" />
...
<jsp:setProperty name="foo" property="*" />
If you have a lot of properties, you may want to create a "reset" property
instead. The setReset() method in the bean can set all properties to their
default value:
<jsp:useBean id="foo" class="com.mycompany.MyBean" />
<jsp:setProperty name="foo" property="reset" value="" />
<jsp:setProperty name="foo" property="*" />
> (Sorry to send this mail to here, cos I try and try to send to SUN JSP
> mailing list, but it keep reject me, I don't know why).
The mailing list server currently seem to send a rejection mail for every
new mail to the list, but it's still being posted. Just ignore it until the
server is fixed.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets