You may want to catch the username.equals("") condition,
and change the return of "" to something like "No Name entered".

      this.username = (( (username==null)||(username.equals("")) )? "No Name
Entered" : username );


Dave

-----Original Message-----
From: Dean Sheppard [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 18, 2000 2:30 PM
To: [EMAIL PROTECTED]
Subject: Re: [SERVLET-INTEREST] Null Values in Servlets


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


***********************************************************************
Privileged/confidential information may be contained in this message.
If you are not the addressee indicated in this message (or responsible
for delivery of the message to such person), you may not copy or
deliver this message to anyone. In such case, you should destroy this
message and notify the sender and [EMAIL PROTECTED]
immediately.

If you or your employer do not consent to Internet E-mail messages of
this kind, please advise us immediately.

Opinions, conclusions and other information expressed in this message
 (including any attachments) are not given or endorsed by ebeon ltd
 (or ebeon inc., as applicable) unless otherwise confirmed in writing
by an authorised representative independent of this message. Any
liability arising from reliance placed on this message (including its
attachments) without such independent confirmation is hereby excluded.

This message (including attachments) is protected by copyright laws
but has no other legal or contractual standing. The presence of this
footnote indicates that this message (including its attachments) has
been processed by an automated anti-virus system; however it is the
responsiblity of the recipient to ensure that the message (and
attachments) are safe and authorised for use in their environment.
***********************************************************************

___________________________________________________________________________
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