Re: Question about page parameters type. String?

2002-04-19 Thread Villén Pizarro, Julia

This answers are very helpfull and my problem is solved, but not my curiosity. 
As you can see I'm not a Java expert but I don't understand why do I have to use this 
methods when color is a String.
Just curiosity, 
thanks,
Julia


-Mensaje original-
De: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 19 de abril de 2002 5:54
Para: [EMAIL PROTECTED]
Asunto: Re: Question about page parameters type. String?


or a much faster way is like this

%
String color;
color=request.getParameter(color)

if (color.intern() ==red) {
--
whatever1
}
else {whatever2}

%

using intern() is quite fast since in equals() each character is checked
which is quite time consuming which intern() gives you the canonical
representation of the string.
in your applications try to use intern() rather than equals().

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 5:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


Hi bhusan,

 That's one point  but she is trying to compare using == method which is for
object referecne but not the value.


No need of casting as paramater always comes as a String and your color
variable in the code is also a String so no need of casting.
-Original Message-
From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
mailto:[mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Subject:Question about page parameters type. String?


Hi all!
I call my_page.jsp this way
http://my_server/my_page.jsp?color=red
http://my_server/my_page.jsp?color=red 

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is if I have to do any kind of casting.
Thaks in advance,
Julia

=
To unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.com 

==To
unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-19 Thread Bhushan_Bhangale

The problem is related to objects. Whenever we define a variable for object only the 
reference of memory(where the actually data of object is stored) gets stored in it. 
The == operater is used to compare the values actually stored in those variables. So 
incase of object variables the == operator gets the memory address and not the value 
stored at that memory address.

The String is an object so it also applies to it.

I hope I manage to explain it, if still have any doubt than you can ask again.

-Original Message-
From: Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 1:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


This answers are very helpfull and my problem is solved, but not my curiosity. 
As you can see I'm not a Java expert but I don't understand why do I have to use this 
methods when color is a String.
Just curiosity, 
thanks,
Julia


-Mensaje original-
De: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 19 de abril de 2002 5:54
Para: [EMAIL PROTECTED]
Asunto: Re: Question about page parameters type. String?


or a much faster way is like this

%
String color;
color=request.getParameter(color)

if (color.intern() ==red) {
--
whatever1
}
else {whatever2}

%

using intern() is quite fast since in equals() each character is checked
which is quite time consuming which intern() gives you the canonical
representation of the string.
in your applications try to use intern() rather than equals().

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 5:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


Hi bhusan,

 That's one point  but she is trying to compare using == method which is for
object referecne but not the value.


No need of casting as paramater always comes as a String and your color
variable in the code is also a String so no need of casting.
-Original Message-
From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
mailto:[mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Subject:Question about page parameters type. String?


Hi all!
I call my_page.jsp this way
http://my_server/my_page.jsp?color=red
http://my_server/my_page.jsp?color=red 

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is if I have to do any kind of casting.
Thaks in advance,
Julia

=
To unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.com 

==To
unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http

Re: Question about page parameters type. String?

2002-04-19 Thread Villén Pizarro, Julia

Ok, ok, I understand.
Is good to know how it works.

-Mensaje original-
De: Bhushan_Bhangale [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 19 de abril de 2002 10:03
Para: [EMAIL PROTECTED]
Asunto: Re: Question about page parameters type. String?


The problem is related to objects. Whenever we define a variable for object only the 
reference of memory(where the actually data of object is stored) gets stored in it. 
The == operater is used to compare the values actually stored in those variables. So 
incase of object variables the == operator gets the memory address and not the value 
stored at that memory address.

The String is an object so it also applies to it.

I hope I manage to explain it, if still have any doubt than you can ask again.

-Original Message-
From: Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 19, 2002 1:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


This answers are very helpfull and my problem is solved, but not my curiosity. 
As you can see I'm not a Java expert but I don't understand why do I have to use this 
methods when color is a String.
Just curiosity, 
thanks,
Julia


-Mensaje original-
De: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
Enviado el: viernes, 19 de abril de 2002 5:54
Para: [EMAIL PROTECTED]
Asunto: Re: Question about page parameters type. String?


or a much faster way is like this

%
String color;
color=request.getParameter(color)

if (color.intern() ==red) {
--
whatever1
}
else {whatever2}

%

using intern() is quite fast since in equals() each character is checked
which is quite time consuming which intern() gives you the canonical
representation of the string.
in your applications try to use intern() rather than equals().

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 5:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


Hi bhusan,

 That's one point  but she is trying to compare using == method which is for
object referecne but not the value.


No need of casting as paramater always comes as a String and your color
variable in the code is also a String so no need of casting.
-Original Message-
From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
mailto:[mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Subject:Question about page parameters type. String?


Hi all!
I call my_page.jsp this way
http://my_server/my_page.jsp?color=red
http://my_server/my_page.jsp?color=red 

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is if I have to do any kind of casting.
Thaks in advance,
Julia

=
To unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.com 

==To
unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Re: Question about page parameters type. String?

2002-04-19 Thread Francisco Manuel Martínez Suárez

The fact is that color is not a string, it is a reference variable to a
String object. The value returned by request.getParameter(color) is an
address to a memory allocation where a String object resides. Inside this
object is the string red. So if you use == to compare the reference
variable color with the string red you will never get a true.

Hope this helps

Fran

 -Mensaje original-
 De:   Villén Pizarro, Julia [SMTP:[EMAIL PROTECTED]]
 Enviado el:   viernes 19 de abril de 2002 8:50
 Para: [EMAIL PROTECTED]
 Asunto:   Re: Question about  page parameters type. String?
 
 This answers are very helpfull and my problem is solved, but not my
 curiosity. 
 As you can see I'm not a Java expert but I don't understand why do I have
 to use this methods when color is a String.
 Just curiosity, 
 thanks,
 Julia
 
 
 -Mensaje original-
 De: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
 Enviado el: viernes, 19 de abril de 2002 5:54
 Para: [EMAIL PROTECTED]
 Asunto: Re: Question about page parameters type. String?
 
 
 or a much faster way is like this
 
 %
 String color;
 color=request.getParameter(color)
 
 if (color.intern() ==red) {
 --
 whatever1
 }
 else {whatever2}
 
 %
 
 using intern() is quite fast since in equals() each character is checked
 which is quite time consuming which intern() gives you the canonical
 representation of the string.
 in your applications try to use intern() rather than equals().
 
 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031
 
 
 -Original Message-
 From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 18, 2002 5:19 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Question about page parameters type. String?
 
 
 Hi bhusan,
 
  That's one point  but she is trying to compare using == method which is
 for
 object referecne but not the value.
 
 
 No need of casting as paramater always comes as a String and your color
 variable in the code is also a String so no need of casting.
 -Original Message-
 From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
 mailto:[mailto:[EMAIL PROTECTED]] 
 Sent:   Thursday, April 18, 2002 5:22 PM
 To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
 Subject:Question about page parameters type. String?
 
 
 Hi all!
 I call my_page.jsp this way
 http://my_server/my_page.jsp?color=red
 http://my_server/my_page.jsp?color=red 
 
 Then I retrieve the value of the parameter color and then try to match
 it,
 in the following way:
 
 %
 String color;
 color=request.getParameter(color)
 if (color==red) {
 whatever1
 }
 else {whatever2}
 
 %
 
 The answer is whatever2. I made sure the page is getting the parameter
 right
 by writing it out. The question is if I have to do any kind of casting.
 Thaks in advance,
 Julia
 
 =
 To unsubscribe: mailto [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
 with body: signoff JSP-INTEREST.
 For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 with body: set JSP-INTEREST DIGEST.
 Some relevant FAQs on JSP/Servlets can be found at:
 http://archives.java.sun.com/jsp-interest.html
 http://archives.java.sun.com/jsp-interest.html 
 http://java.sun.com/products/jsp/faq.html
 http://java.sun.com/products/jsp/faq.html 
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.esperanto.org.nz/jsp/jspfaq.jsp 
 http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
 http://www.jspinsider.com http://www.jspinsider.com 
 
 ==
 To
 unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 with body: signoff JSP-INTEREST.
 For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 with body: set JSP-INTEREST DIGEST.
 Some relevant FAQs on JSP/Servlets can be found at:
 http://archives.java.sun.com/jsp-interest.html
 http://archives.java.sun.com/jsp-interest.html 
 http://java.sun.com/products/jsp/faq.html
 http://java.sun.com/products/jsp/faq.html 
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.esperanto.org.nz/jsp/jspfaq.jsp 
 http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
 http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
  http://java.sun.com/products/jsp/faq.html
  http://www.esperanto.org.nz/jsp/jspfaq.jsp
  http://www.jguru.com/faq/index.jsp
  http://www.jspinsider.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

Question about page parameters type. String?

2002-04-18 Thread Villén Pizarro, Julia

Hi all!

I call my_page.jsp this way
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter color and then try to match it, in the 
following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right by 
writing it out. The question is
if I have to do any kind of casting.

Thaks in advance,

Julia

==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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread sbpodila

hi,
check like this it will work


if(color.equals(red)

regards
Sasi.


- Original Message -
From: Villén Pizarro, Julia [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 5:22 PM
Subject: Question about page parameters type. String?


Hi all!

I call my_page.jsp this way
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is
if I have to do any kind of casting.

Thaks in advance,

Julia

=
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread Bhushan_Bhangale

No need of casting as paramater always comes as a String and your color variable in 
the code is also a String so no need of casting.

-Original Message-
From: Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED]
Subject: Question about page parameters type. String?


Hi all!

I call my_page.jsp this way
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter color and then try to match it, in the 
following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right by 
writing it out. The question is
if I have to do any kind of casting.

Thaks in advance,

Julia

=
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread Villén Pizarro, Julia

Thanks a lot for such fast answers.
Julia

-Mensaje original-
De: sbpodila [mailto:[EMAIL PROTECTED]]
Enviado el: jueves, 18 de abril de 2002 14:04
Para: [EMAIL PROTECTED]
Asunto: Re: Question about page parameters type. String?


hi,
check like this it will work


if(color.equals(red)

regards
Sasi.


- Original Message -
From: Villén Pizarro, Julia [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 18, 2002 5:22 PM
Subject: Question about page parameters type. String?


Hi all!

I call my_page.jsp this way
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is
if I have to do any kind of casting.

Thaks in advance,

Julia

=
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread Kesav, Ramesh

Try this
%
String color;
color=request.getParameter(color)
if (color.equals(red) {
whatever1
}
else {whatever2}

%


Regards

Ramesh Kesavanarayanan
Off : 91-44-8113801 ext 2333
Tel:91-44-2265360
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 



-Original Message-
From:   Villén Pizarro, Julia [SMTP:[EMAIL PROTECTED]]
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED]
Subject:Question about  page parameters type. String?

Hi all!

I call my_page.jsp this way
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter color and then try to
match it, in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the
parameter right by writing it out. The question is
if I have to do any kind of casting.

Thaks in advance,

Julia


==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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread Kesav, Ramesh

Hi bhusan,

 That's one point  but she is trying to compare using == method which is for
object referecne but not the value.


No need of casting as paramater always comes as a String and your color
variable in the code is also a String so no need of casting.
-Original Message-
From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
mailto:[mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Subject:Question about page parameters type. String?


Hi all!
I call my_page.jsp this way
http://my_server/my_page.jsp?color=red
http://my_server/my_page.jsp?color=red 

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is if I have to do any kind of casting.
Thaks in advance,
Julia

=
To unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.com 

==To
unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread Vikramjit Singh

or a much faster way is like this

%
String color;
color=request.getParameter(color)

if (color.intern() ==red) {
--
whatever1
}
else {whatever2}

%

using intern() is quite fast since in equals() each character is checked
which is quite time consuming which intern() gives you the canonical
representation of the string.
in your applications try to use intern() rather than equals().

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 5:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


Hi bhusan,

 That's one point  but she is trying to compare using == method which is for
object referecne but not the value.


No need of casting as paramater always comes as a String and your color
variable in the code is also a String so no need of casting.
-Original Message-
From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
mailto:[mailto:[EMAIL PROTECTED]] 
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Subject:Question about page parameters type. String?


Hi all!
I call my_page.jsp this way
http://my_server/my_page.jsp?color=red
http://my_server/my_page.jsp?color=red 

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is if I have to do any kind of casting.
Thaks in advance,
Julia

=
To unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.com 

==To
unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html 
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html 
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp 
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp 
http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Question about page parameters type. String?

2002-04-18 Thread Ashwani Kalra

Hi,
I was seeing the description of the intern() method , and could not
understand how it can be faster than equal() method. As intern() internally
calls the equal method . Am I correct ??

Regds
Ashwani


- Original Message -
From: Vikramjit Singh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, April 19, 2002 9:24 AM
Subject: Re: Question about page parameters type. String?


or a much faster way is like this

%
String color;
color=request.getParameter(color)

if (color.intern() ==red) {
--
whatever1
}
else {whatever2}

%

using intern() is quite fast since in equals() each character is checked
which is quite time consuming which intern() gives you the canonical
representation of the string.
in your applications try to use intern() rather than equals().

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 5:19 AM
To: [EMAIL PROTECTED]
Subject: Re: Question about page parameters type. String?


Hi bhusan,

 That's one point  but she is trying to compare using == method which is for
object referecne but not the value.


No need of casting as paramater always comes as a String and your color
variable in the code is also a String so no need of casting.
-Original Message-
From:   Villén Pizarro, Julia [mailto:[EMAIL PROTECTED]]
mailto:[mailto:[EMAIL PROTECTED]]
Sent:   Thursday, April 18, 2002 5:22 PM
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Subject:Question about page parameters type. String?


Hi all!
I call my_page.jsp this way
http://my_server/my_page.jsp?color=red
http://my_server/my_page.jsp?color=red

Then I retrieve the value of the parameter color and then try to match it,
in the following way:

%
String color;
color=request.getParameter(color)
if (color==red) {
whatever1
}
else {whatever2}

%

The answer is whatever2. I made sure the page is getting the parameter right
by writing it out. The question is if I have to do any kind of casting.
Thaks in advance,
Julia

=
To unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com http://www.jspinsider.com

==To
unsubscribe: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: signoff JSP-INTEREST.
For digest: mailto [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
with body: set JSP-INTEREST DIGEST.
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com