You cannot compare String like this. Use the "equals" keyword instead.
  For example :
     if (mystring.substring(something).equals(somethingElse) )

  Hope this helps.


>From: Jean Chiang(¦¿²Q§g) <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>     reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: The comparison between string and char.
>Date: Tue, 2 Jan 2001 13:23:05 +0800
>
>I am new to JSP. Who is going to help me? Thanks in advance.
>I read some input from a text file and the first parameter is an int and
>others are string. I have to do different action according to the first
>parameter.
>A part of my source code is listed as follows:
>
>In this case, when my first parameter is "1", it still shows "no". What's
>wrong? I suppose it cannot compare char and string. but how can I deal with
>this stuff?
>
>
><%   BufferedReader in = new BufferedReader(
>                          new InputStreamReader(
>                           yc.getInputStream()));
>
>  String inputLine;
>
>if ( inputLine.substring(0,1) == "1" ) {
>    out.println("yes");
>  }
>else {
>     out.println("no");
>}
>%>
>
>===========================================================================
>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

_________________________________________________________________________
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

Reply via email to