You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Olivier Boulanger <Bo...@Lucid-it.com> on 2002/03/12 12:49:24 UTC

RE: Rep. : [JSP/JAVABEANS] set method and empty parameters...

Hello,

Thanks a lot...

...but in fact, i'd like to set to null the parameters whose values are
explicitly empty strings (and not all of them) :
i've got more than one form to set the properties of my bean, and they all
call the same jsp page to process the <jsp:setProperty name="myBean"
property="*"/> instruction...

...and i don't want to clear the properties which aren't linked to the
validated form...

I could write a JSP page for each form I use, but it would be really nice to
know how to process the "set" method on an empty parameter...

Olivier

-----Message d'origine-----
De : Sebastien BASTARD [mailto:sbastard@e-contact.fr]
Envoye : mardi 12 mars 2002 12:28
A : tomcat-user@jakarta.apache.org
Objet : Rep. : [JSP/JAVABEANS] set method and empty parameters...


Hello,

You can execute a method such as 'prepareParam' which set all variables to
null of your JavaBean.
Thus, you have, as default, null to your variables.

Example :

<jsp:setProperty name="myBean" property="prepareParam"/>
<jsp:setProperty name="myBean" property="*"/>

void setPrepareParam() {
  v1=null;
  v2=null;
  etc ...
}

Seb

>>> Boulanger@Lucid-it.com 12/03 12h19 >>>
Hi all,

I send some values of a html form (using post method) to a JSP page, which
calls a JavaBean to actualize its properties (<jsp:setProperty name="myBean"
property="*"/>).

But when a field of the form is null (empty string in the form), the "set"
method of the bean is not executed.

Ex : in the form, the value of the field "toto" is changed from "aaa" to
null : the setToto method of the bean is not called, and the value of the
toto property is not actualized...

A solution would really be appreciate :-)

Many thanks,

Olivier



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>





--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: Rep. : [JSP/JAVABEANS] set method and empty parameters...

Posted by Nicolas Silberzahn <Ni...@DigitalAirways.com>.

Bonjour,

Does the browser send the information?

Bonne journee,

Nicolas Silberzahn

Digital Airways
Everywhere <Internet>Technologies</Internet>
www.DigitalAirways.com


>-----Message d'origine-----
>De : Olivier Boulanger [mailto:Boulanger@Lucid-it.com]
>Envoye : mardi 12 mars 2002 12:49
>A : Tomcat Users List
>Objet : RE: Rep. : [JSP/JAVABEANS] set method and empty parameters...
>
>
>Hello,
>
>Thanks a lot...
>
>...but in fact, i'd like to set to null the parameters whose values are
>explicitly empty strings (and not all of them) :
>i've got more than one form to set the properties of my bean, and they all
>call the same jsp page to process the <jsp:setProperty name="myBean"
>property="*"/> instruction...
>
>...and i don't want to clear the properties which aren't linked to the
>validated form...
>
>I could write a JSP page for each form I use, but it would be 
>really nice to
>know how to process the "set" method on an empty parameter...
>
>Olivier
>
>-----Message d'origine-----
>De : Sebastien BASTARD [mailto:sbastard@e-contact.fr]
>Envoye : mardi 12 mars 2002 12:28
>A : tomcat-user@jakarta.apache.org
>Objet : Rep. : [JSP/JAVABEANS] set method and empty parameters...
>
>
>Hello,
>
>You can execute a method such as 'prepareParam' which set all variables to
>null of your JavaBean.
>Thus, you have, as default, null to your variables.
>
>Example :
>
><jsp:setProperty name="myBean" property="prepareParam"/>
><jsp:setProperty name="myBean" property="*"/>
>
>void setPrepareParam() {
>  v1=null;
>  v2=null;
>  etc ...
>}
>
>Seb
>
>>>> Boulanger@Lucid-it.com 12/03 12h19 >>>
>Hi all,
>
>I send some values of a html form (using post method) to a JSP page, which
>calls a JavaBean to actualize its properties (<jsp:setProperty 
>name="myBean"
>property="*"/>).
>
>But when a field of the form is null (empty string in the form), the "set"
>method of the bean is not executed.
>
>Ex : in the form, the value of the field "toto" is changed from "aaa" to
>null : the setToto method of the bean is not called, and the value of the
>toto property is not actualized...
>
>A solution would really be appreciate :-)
>
>Many thanks,
>
>Olivier
>
>
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>
>
>
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>
>
>
>
>
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>
>
>

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>