thanks, Will
-----Original Message----- From: Java Man [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 28, 2001 12:01 PM To: [EMAIL PROTECTED] Subject: Re: checking value of parameter from jsp Hey mate, Don't do this kind of comparison with Strings: if (param == "") The right form: if (param.equals("")) In the first way you're comparing memory address. The second one compares the content of the String. Basic rules, man! Cheers! --- "Kwan, William" <[EMAIL PROTECTED]> escreveu: > Hi all, > > I'm passing information from a html page to a > servlet. > > Here is some code: > > String param = request.getParameter("name"); > if (param == null) sqlstr = "Select * from name"; > else sqlstr ="Select * from name where fname like > '"+param + "'"; > > and > > if (param == "") sqlstr = "Select * from name"; > else sqlstr ="Select * from name where fname like > '"+param + "'"; > > These both dont detect the blank value when they > click submit on the jsp > page. It always goes to the else part. > > Am I doing something wrong?? Is there another way > to detect if they entered > any data in the field on the form?? > > thanks, > Will > > ___________________________________________________________________________ > 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 > ____________________________________________________________________________ ___________________ Yahoo! GeoCities Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. � f�cil e gr�tis! http://br.geocities.yahoo.com/ ___________________________________________________________________________ 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
