Use introspection to capture all valid .getParameters(), then the bean
associated to the form can simply check for null values when assigning them


Ie...

        public void setUserName(String username) {
                this.username = (( username==null)? "" : username );
        }

This should alleviate the null value problems. If you are not familiar with
introspection I would recommend reading about it on the javasoft site. It
would help if you were implementing your JSP/Servlets using the Model 2
architecture as well.

Hope this helps... Dean


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet API
Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Silvia Gaspar
Sent: Friday, August 18, 2000 8:58 AM
To: [EMAIL PROTECTED]
Subject: Null Values in Servlets
Importance: High

        This data comes from a form and its pass to the servlet when we
press the submit button, so I don't have any type of control over that. If
the user don't write nothing, the field will have the null value in the
servlet.

Com os nossos melhores cumprimentos,
----------------------------------------------------------------------------
-------------------------------
Compta - Equipamentos e Servi�os de inform�tica, S.A

S�lvia Gaspar
Engenharia de Sistemas e Aplica��es
Implementa��o
Consultora  S�nior
?  TEL: +351.21. 350 14 00
?  Directo:     +351.21. 313 55 51
?    Fax:       +351.21.352 02 02
??e-mail:    [EMAIL PROTECTED]
? WWW:      www.compta.pt

-----Original Message-----
From:   Girish K [mailto:[EMAIL PROTECTED]]
Sent:   sexta-feira, 18 de Agosto de 2000 12:34
To:     [EMAIL PROTECTED]
Subject:

One option is to use "" instead of sending empty values. Invariably, from
what I have noticed, these are 'null' values. If not set, then this causes
an error.
I hope this helps,
Girish

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to