the point is, that
request.getParameter("sub") == ""
checks if the string Object returned from request.getParameter("sub") is the
same string object as "".
And because of they are not the same object you get always false. You want
to check if the two object contains the same!!! That is a big difference. so
you have to use eihter:
request.getParameter("sub").equals("") // which check if the stringobject
returned from
//request.getParameter("sub")
contains ""
or
request.getParameter("sub") == null // which checks if no stringobject
// is returned from
request.getParameter("sub")
both "methods" are not the same !!!!
-----Ursprungliche Nachricht-----
Von: Tony Leake [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 1. Marz 2001 14:42
An: [EMAIL PROTECTED]
Betreff: Simple newbie question
Hi,
I'm trying to test a parameter to see if it exists:
on page 1 i have a form with a text field
<input type="text" name="thread">
on page 2 i want to test if the box was filled in and if it contains a
string or a number. I can't even seem to test if thread is empty.
I've tried
if(request.getParameter("sub")=="")
{
//stuff
}
but that doesn't seem to do anything.
thanks for any help
Tony
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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