RE: getParameter is NOT a string?

2000-11-18 Thread Brett Bergquist
: getParameter is NOT a string? Brett Bergquist wrote: > Actually the test that you want is: > > if (user.compareTo("admin") == 0) { > ... > } And how is this any different from using "if (user.equals("admin"))"? --

Re: getParameter is NOT a string?

2000-11-18 Thread Miles Daffin
Hi Charles, > A few notes: > > 1) java.lang.Comparable is new in Java2. It's not there >if you are running w/Java 1.1 (OK with Tomcat 3.x). > > 2) compareTo(), for Strings does a *lexical* comparison. >Semantically, this code wants to know that the user >is "admin", not that the u

Re: getParameter is NOT a string?

2000-11-18 Thread Charles Forsythe
Miles Daffin wrote: > > > Brett Bergquist wrote: > > > Actually the test that you want is: > > > > > > if (user.compareTo("admin") == 0) { > > > ... > > > } > > > > And how is this any different from using > > "if (user.equals("admin"))"? > ... > 'compareTo(Object

Re: getParameter is NOT a string?

2000-11-18 Thread Miles Daffin
> Brett Bergquist wrote: > > Actually the test that you want is: > > > > if (user.compareTo("admin") == 0) { > > ... > > } > > And how is this any different from using "if (user.equals("admin"))"? The method 'compareTo(Object o)' is specified in java.lang.Comparabl

Re: getParameter is NOT a string?

2000-11-18 Thread Miles Daffin
> if (user == "admin") > { > } > > then it doesnt go into this condition, but goes into the ELSE instead!!! > > Why is this? You need to do some basic Java study. The conditional test above actually asks this: If the explicit String type object reference 'user' points to the same

Re: getParameter is NOT a string?

2000-11-18 Thread JTBldrCO
Note for newer Java programmers: For this example, they are equivalent. But String.compareTo() returns an int and can be used, like the C function memcmp(), to test all of >, ==, and <. In addition to String.equals(), do not overlook String.equalsIngoreCase(), should you need a case-insensit

Re: getParameter is NOT a string?

2000-11-18 Thread Kurt Bernhard Pruenner
Brett Bergquist wrote: > Actually the test that you want is: > > if (user.compareTo("admin") == 0) { > ... > } And how is this any different from using "if (user.equals("admin"))"? -- Kurt Pruenner - Haendelstrasse 17, 4020 Linz, Austria | Briareos at Olymp BBS:

RE: getParameter is NOT a string?

2000-11-18 Thread Brett Bergquist
Actually the test that you want is: if (user.compareTo("admin") == 0) { ... } -Original Message- From: Cliff Rowley [mailto:[EMAIL PROTECTED]] Sent: Saturday, November 18, 2000 7:35 AM To: [EMAIL PROTECTED] Subject: RE: getParameter is NO

RE: getParameter is NOT a string?

2000-11-18 Thread Cliff Rowley
Cliff Rowley The reader this message encounters not failing to understand is cursed. - while ( !asleep ) { code(); } -Original Message- From: Winnie Cheung [mailto:[EMAIL PROTECTED]] Sent: 18 November 2000 05:55 To: [EMAIL PROTECTED] Subject: getParameter is NOT a string? Hi I am getting

RE: getParameter is NOT a string?

2000-11-17 Thread CPC Livelink Admin
ge- From: Winnie Cheung [mailto:[EMAIL PROTECTED]] Sent: Saturday, November 18, 2000 12:55 AM To: [EMAIL PROTECTED] Subject: getParameter is NOT a string? Hi I am getting a form field (POSTed form) as String user = (String) request.getParameter("user"); When I out.print this, it

getParameter is NOT a string?

2000-11-17 Thread Winnie Cheung
Hi I am getting a form field (POSTed form) as String user = (String) request.getParameter("user"); When I out.print this, it writes the correct value, but when i COMPARE this in an IF condition, it doesnt work. Any reason why? For example, lets say the "user" textfield in my form is "admin".