Re: R: "if" don't work?!?!?

2007-05-22 Thread David Delbecq
Nope, this only works if the string is a variant of True, not on the 1,
yes, si cases :)
Also, only value supposed to be sent by browser is the value=""
field of input checkbox. And html 4 specs states that for checkboxes and
radio boxes this value *must* be present in html :)


Yeah, i too thought to post this request on sidebar. Long time not seen
a Paula related stuff. Did you code a Calculator recently? :D

Christopher Schultz a écrit :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Massimiliano,
>
> Massimiliano PASQUALONI wrote:
>
> String Paula = "Brilliant";
>
> You can replace all the code below with this gem:
>
> boolean myBoolean = Boolean.valueOf(yourString).booleanValue();
>
> Don't try to re-invent the wheel. Most of the things like this have
> already been done by someone else, and probably better. So, learn from
> and take advantage of the work others have done before you.
>
>   
>> public boolean StringToBoolean(String StrBool)
>>   {
>>  boolean convertito=false;
>>
>>  if ((StrBool == "1") || (StrBool == "On") || (StrBool ==
>> "on") || (StrBool == "Yes") || (StrBool == "yes") || (StrBool == "Si") ||
>> (StrBool == "si") || (StrBool == "True") || (StrBool == "true"))
>>  {
>>  convertito = true;
>>  }
>>
>>  if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
>> "off") || (StrBool =="No") || (StrBool == "no") || (StrBool == 
>> "False")
>> || (StrBool == "false"))
>>  {
>>  convertito = false;
>>  }
>>
>>  return convertito;
>>   }
>> 
>
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGUzgE9CaO5/Lv0PARAlJJAJ9XdavG7OXesi3bTaqMVdrJe3nUqwCgwuNU
> 2K2hHPrMKDH8NLAHvKcR8ek=
> =fK6t
> -END PGP SIGNATURE-
>
> -
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>   

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] "if" don't work?!?!?

2007-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
>> Subject: Re: [OT] "if" don't work?!?!?
>>
>> String Pippo = "on";
>>
>> if(Pippo == "on")
>>System.err.println("Pippo is on, man!");
> 
> Again, that's not what the OP coded; Pippo was retrieved from the
> request, not set to a constant.  Changing the context of the if
> statement can certainly changes the result.

Agreed. Your quote, however, was out of context. You only showed the
comparison between a (most likely String) reference type and a literal
string and asserted that it was guaranteed not to work. In that context
(i.e. none), your statement was not true.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGU0vc9CaO5/Lv0PARAptfAJd/xAWaVEtfhSAnSYhGMvKGqpEVAJ9KE5hq
BvycOhmewUhMklkNDbeatg==
=wizm
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] "if" don't work?!?!?

2007-05-22 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
> Subject: Re: [OT] "if" don't work?!?!?
> 
> String Pippo = "on";
> 
> if(Pippo == "on")
>System.err.println("Pippo is on, man!");

Again, that's not what the OP coded; Pippo was retrieved from the
request, not set to a constant.  Changing the context of the if
statement can certainly changes the result.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: "if" don't work?!?!?

2007-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Bryce,

Bryce Burgess (bburgess) wrote:
> Would this work for you?
> ( http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#toLowerCase() 
> )

String.equalsIgnoreCase is much better.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUzhA9CaO5/Lv0PARAov3AJwJ1Pb0vyNKuBhdcKiobNLWfTntZwCgumW8
7HZczna2SiSQ1sGZ3d2ZtRs=
=08+U
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: R: "if" don't work?!?!?

2007-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Massimiliano,

Massimiliano PASQUALONI wrote:

String Paula = "Brilliant";

You can replace all the code below with this gem:

boolean myBoolean = Boolean.valueOf(yourString).booleanValue();

Don't try to re-invent the wheel. Most of the things like this have
already been done by someone else, and probably better. So, learn from
and take advantage of the work others have done before you.

> public boolean StringToBoolean(String StrBool)
>{
>   boolean convertito=false;
> 
>   if ((StrBool == "1") || (StrBool == "On") || (StrBool ==
> "on") || (StrBool == "Yes") || (StrBool == "yes") || (StrBool == "Si") ||
> (StrBool == "si") || (StrBool == "True") || (StrBool == "true"))
>   {
>   convertito = true;
>   }
> 
>   if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
> "off") || (StrBool == "No") || (StrBool == "no") || (StrBool == "False")
> || (StrBool == "false"))
>   {
>   convertito = false;
>   }
> 
>   return convertito;
>}

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUzgE9CaO5/Lv0PARAlJJAJ9XdavG7OXesi3bTaqMVdrJe3nUqwCgwuNU
2K2hHPrMKDH8NLAHvKcR8ek=
=fK6t
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] "if" don't work?!?!?

2007-05-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

Caldarale, Charles R wrote:
>> From: Massimiliano PASQUALONI 
>> [mailto:[EMAIL PROTECTED] 
>> Subject: "if" don't work?!?!?
>>
>>if (Pippo == "on") {
> 
> Guaranteed to be false.

Not always:

String Pippo = "on";

if(Pippo == "on")
   System.err.println("Pippo is on, man!");

...will print the string ;)

But, of course, this is a /super/ special case where Java's constant
pool is involved. Someone who doesn't understand why "Pippo == "on"
doesn't always work is going to have their mind blown by the constant pool.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGUzc99CaO5/Lv0PARAoktAJ0aTbR2XlrB3CD6PjMUlEsJMIO0pwCgn1zy
SwD0cbGDStbYkxoYtcummaI=
=J+fl
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: R: "if" don't work?!?!?

2007-05-22 Thread David Delbecq
Massimiliano PASQUALONI a écrit :
> public boolean StringToBoolean(String StrBool)
>{
>   boolean convertito=false;
>
>   if ((StrBool == "1") || (StrBool == "On") || (StrBool ==
> "on") || (StrBool == "Yes") || (StrBool == "yes") || (StrBool == "Si") ||
> (StrBool == "si") || (StrBool == "True") || (StrBool == "true"))
>   {
>   convertito = true;
>   }
>
>   if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
> "off") || (StrBool == "No") || (StrBool == "no") || (StrBool == "False")
> || (StrBool == "false"))
>   {
>   convertito = false;
>   }
>
>   return convertito;
>}
>   
OMG :)
> If I try 
>
>   if ("on".equals(request.getParameter("abilitato"))){
>   Abilitato = true;
>   }
>
>
>   
Works if parameter abilitato is 'on' (not 'On' or 'checked' or whatever
other browser is using)
> Or 
>
>if (request.getParameter("abilitato").equals("on")){
>   Abilitato = true;
>   }
>   
same as above. Also if checkbox is not checked, most browser don't send
parameter an you will end up with a NullPointerException. Check
parameter is not null before calling equals()
> Or
>
>   if (request.getParameter("abilitato") == "on"){
>   Abilitato = true;
>   }
>   
Omg² :)
>   Referer = request.getHeader("Referer") 
>   AltroReferer = request.getHeader("Referer") 
>
>   if (Referer == AltroReferer ){...}
>
>   
As already said, not garanteed to work


I recommend you read this:
http://jamesthornton.com/eckel/TIJ-3rd-edition4.0/TIJ303.htm

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: "if" don't work?!?!?

2007-05-22 Thread Bryce Burgess \(bburgess\)

Would this work for you?
( http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#toLowerCase() )

Javabean:

public boolean StringToBoolean(String StrBool)
 {
 boolean convertito=false;
   // since the default is false, only need to check the true... 
   // If any of these are true, return true, else return false (on any 
string of characters...)

if ((contentEquals(toLowerCase(StrBool) "1"))|| 
(contentEquals(toLowerCase(StrBool) "on"))   || 
(contentEquals(toLowerCase(StrBool) "yes"))  || 
(contentEquals(toLowerCase(StrBool) "si"))   || 
(contentEquals(toLowerCase(StrBool) "true")) )
{
convertito = true;
}

 return convertito;
 }



-Original Message-
From: Massimiliano PASQUALONI [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 22, 2007 9:58 AM
To: 'Tomcat Users List'
Subject: R: "if" don't work?!?!?

No, don't work!

Im try a simple function in my javabean that "convert" from string to
boolean:

JSP:
String Prova = request.getParameter("abilitato");
 // where abilitato is a checkbox in a form





Javabean:

public boolean StringToBoolean(String StrBool)
 {
boolean convertito=false;



if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
"off") || (StrBool ==   "No") || (StrBool == "no") || (StrBool == "False")
|| (StrBool == "false"))
{
convertito = false;
}

return convertito;
 }
 







If I try 

if ("on".equals(request.getParameter("abilitato"))){
Abilitato = true;
}



Or 

 if (request.getParameter("abilitato").equals("on")){
Abilitato = true;
}

Or

if (request.getParameter("abilitato") == "on"){
Abilitato = true;
}

Or 
Boolean Abilitato = bean.StringToBoolean(Prova);


I have the same result: don't work..


Yesterday I've try also

Referer = request.getHeader("Referer") 
AltroReferer = request.getHeader("Referer") 

if (Referer == AltroReferer ){...}

And don't work.


:-O




-Messaggio originale-
Da: Edoardo Panfili [mailto:[EMAIL PROTECTED]
Inviato: martedì 22 maggio 2007 16.44
A: Tomcat Users List
Oggetto: Re: "if" don't work?!?!?

Massimiliano PASQUALONI ha scritto:
> Hi guy!
>  
> Wat's happen??
>  
> If i read an checkrequest post
> 
> String Pippo = request.getParameter("abilitato");
> 
> out.print(Pippo);
> 
> return me= on
> 
> If I try to make a condition whit if:
> 
>  
> 
>if (Pippo == "on") {
> 
> 
> 
> }

Maybe possible that I don't understand...

String pippo = request.getParameter("abilitato");
if (pippo.equals("on")) {
// ...
}


Edoardo

--
[EMAIL PROTECTED]
AIM: edoardopn
Jabber: [EMAIL PROTECTED]
tel:075 9142766

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Scanned with Copfilter Version 0.83beta3a (ProxSMTP 1.4)
AntiVirus: ClamAV 0.88.4/3281 - Tue May 22 10:50:43 2007 by Markus Madlener @ 
http://www.copfilter.org

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: 
[EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: R: "if" don't work?!?!?

2007-05-22 Thread Mike Peremsky
As previously mentioned your examples should work as modified below:
   
   
  String Pippo = request.getParameter("abilitato");


if (Pippo.equals("on")) {

}

 
Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");
 
if (Pippo.quals(Pluto))  
   
  Pippo == Pluto will never be true unless you possibly set Pippo = Pluto first.
  

Massimiliano PASQUALONI <[EMAIL PROTECTED]> wrote:
  counter-order!!!


The equals method don't work if I put the request in his parameter, but if a
read the request and I set a String, if i put this string in the parameters,
it work!





-Messaggio originale-
Da: Propes, Barry L [mailto:[EMAIL PROTECTED] 
Inviato: martedì 22 maggio 2007 17.04
A: Tomcat Users List
Oggetto: RE: "if" don't work?!?!?

if (Pippo.equals(Pluto)) maybe?

-Original Message-
From: Massimiliano PASQUALONI
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 22, 2007 9:40 AM
To: 'Tomcat Users List'
Subject: "if" don't work?!?!?


Hi guy!

Wat's happen??

If i read an checkrequest post

String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:



if (Pippo == "on") {

 

}

these don't work

And is'nt the first time, 

if I try

Pippo = request.getParameter("abilitato");
Pluto = request.getParameter("abilitato");

the if (Pippo == Pluto ) don't work!



:-(

please, help me!

Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO" 
torre D
70010 CASAMASSIMA (BA)

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Scanned with Copfilter Version 0.83beta3a (ProxSMTP 1.4)
AntiVirus: ClamAV 0.88.4/3281 - Tue May 22 10:50:43 2007
by Markus Madlener @ http://www.copfilter.org

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



   
-
Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV. 

R: R: "if" don't work?!?!?

2007-05-22 Thread Massimiliano PASQUALONI
No, I don't have set any value ont the checkbox, is a boolean choise, I use
the default value.


I think i've fixed my page whit the equals method...


I'm sorry for the nuisance, heartfelt thanks to every Tomcat Users, bye!



Massimiliano


-Messaggio originale-
Da: Edoardo Panfili [mailto:[EMAIL PROTECTED] 
Inviato: martedì 22 maggio 2007 17.06
A: Tomcat Users List
Oggetto: Re: R: "if" don't work?!?!?

Massimiliano PASQUALONI ha scritto:
> No, don't work!
> 
> Im try a simple function in my javabean that "convert" from string to
> boolean:
> 
> JSP:
> String Prova = request.getParameter("abilitato");
>  // where abilitato is a checkbox in a form
can you post the HTML fragment of the form?
Do you have somethinkg like
 ?
check the value of "value" attribute of "input" element

Edoardo

> 
> 
> 
> 
> 
> Javabean:
> 
> public boolean StringToBoolean(String StrBool)
>{
>   boolean convertito=false;
> 
>   if ((StrBool == "1") || (StrBool == "On") || (StrBool ==
> "on") || (StrBool == "Yes") || (StrBool == "yes") || (StrBool == "Si") 
> || (StrBool == "si") || (StrBool == "True") || (StrBool == "true"))
>   {
>   convertito = true;
>   }
> 
>   if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
> "off") || (StrBool == "No") || (StrBool == "no") || (StrBool == "False")
> || (StrBool == "false"))
>   {
>   convertito = false;
>   }
> 
>   return convertito;
>}
>  
> 
> 
> 
> 
> 
> 
> 
> If I try
> 
>   if ("on".equals(request.getParameter("abilitato"))){
>   Abilitato = true;
>   }
> 
> 
> 
> Or
> 
>if (request.getParameter("abilitato").equals("on")){
>   Abilitato = true;
>   }
> 
> Or
> 
>   if (request.getParameter("abilitato") == "on"){
>   Abilitato = true;
>   }
> 
> Or 
>       Boolean Abilitato = bean.StringToBoolean(Prova);
> 
> 
> I have the same result: don't work..
> 
> 
> Yesterday I've try also
> 
>   Referer = request.getHeader("Referer") 
>   AltroReferer = request.getHeader("Referer")
> 
>   if (Referer == AltroReferer ){...}
> 
> And don't work.
> 
> 
> :-O
> 
> 
> 
> 
> -Messaggio originale-
> Da: Edoardo Panfili [mailto:[EMAIL PROTECTED]
> Inviato: martedì 22 maggio 2007 16.44
> A: Tomcat Users List
> Oggetto: Re: "if" don't work?!?!?
> 
> Massimiliano PASQUALONI ha scritto:
>> Hi guy!
>>  
>> Wat's happen??
>>  
>> If i read an checkrequest post
>>
>> String Pippo = request.getParameter("abilitato");
>>
>> out.print(Pippo);
>>
>> return me= on
>>
>> If I try to make a condition whit if:
>>
>>  
>>
>>if (Pippo == "on") {
>>
>> 
>>
>> }
> 
> Maybe possible that I don't understand...
> 
> String pippo = request.getParameter("abilitato");
> if (pippo.equals("on")) {
>   // ...
> }
> 
> 
> Edoardo
> 


--
[EMAIL PROTECTED]
AIM: edoardopn
Jabber: [EMAIL PROTECTED]
tel:075 9142766

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Scanned with Copfilter Version 0.83beta3a (ProxSMTP 1.4)
AntiVirus: ClamAV 0.88.4/3281 - Tue May 22 10:50:43 2007
by Markus Madlener @ http://www.copfilter.org

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



R: "if" don't work?!?!?

2007-05-22 Thread Massimiliano PASQUALONI
counter-order!!!


The equals method don't work if I put the request in his parameter, but if a
read the request and I set a String, if i put this string in the parameters,
it work!



 

-Messaggio originale-
Da: Propes, Barry L [mailto:[EMAIL PROTECTED] 
Inviato: martedì 22 maggio 2007 17.04
A: Tomcat Users List
Oggetto: RE: "if" don't work?!?!?

 if (Pippo.equals(Pluto)) maybe?

-Original Message-
From: Massimiliano PASQUALONI
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 22, 2007 9:40 AM
To: 'Tomcat Users List'
Subject: "if" don't work?!?!?


Hi guy!
 
Wat's happen??
 
If i read an checkrequest post

String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 

   if (Pippo == "on") {



}

these don't work
 
And is'nt the first time, 
 
if I try
 
Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");
 
the if (Pippo == Pluto )  don't work!
 
 
 
:-(
 
please, help me!

Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO" 
torre D
70010 CASAMASSIMA (BA)

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Scanned with Copfilter Version 0.83beta3a (ProxSMTP 1.4)
AntiVirus: ClamAV 0.88.4/3281 - Tue May 22 10:50:43 2007
by Markus Madlener @ http://www.copfilter.org

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: R: "if" don't work?!?!?

2007-05-22 Thread Edoardo Panfili

Massimiliano PASQUALONI ha scritto:

No, don't work!

Im try a simple function in my javabean that "convert" from string to
boolean:

JSP:
String Prova = request.getParameter("abilitato");
 // where abilitato is a checkbox in a form

can you post the HTML fragment of the form?
Do you have somethinkg like

?
check the value of "value" attribute of "input" element

Edoardo







Javabean:

public boolean StringToBoolean(String StrBool)
 {
boolean convertito=false;

if ((StrBool == "1") || (StrBool == "On") || (StrBool ==
"on") || (StrBool == "Yes") || (StrBool == "yes") || (StrBool == "Si") ||
(StrBool == "si") || (StrBool == "True") || (StrBool == "true"))
{
convertito = true;
}

if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
"off") || (StrBool == "No") || (StrBool == "no") || (StrBool == "False")
|| (StrBool == "false"))
{
convertito = false;
}

return convertito;
 }
 








If I try 


if ("on".equals(request.getParameter("abilitato"))){
Abilitato = true;
}



Or 


 if (request.getParameter("abilitato").equals("on")){
Abilitato = true;
}

Or

if (request.getParameter("abilitato") == "on"){
Abilitato = true;
}

Or 
	Boolean Abilitato = bean.StringToBoolean(Prova);



I have the same result: don't work..


Yesterday I've try also

	Referer = request.getHeader("Referer") 
	AltroReferer = request.getHeader("Referer") 


if (Referer == AltroReferer ){...}

And don't work.


:-O




-Messaggio originale-
Da: Edoardo Panfili [mailto:[EMAIL PROTECTED] 
Inviato: martedì 22 maggio 2007 16.44

A: Tomcat Users List
Oggetto: Re: "if" don't work?!?!?

Massimiliano PASQUALONI ha scritto:

Hi guy!
 
Wat's happen??
 
If i read an checkrequest post


String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 


   if (Pippo == "on") {




}


Maybe possible that I don't understand...

String pippo = request.getParameter("abilitato");
if (pippo.equals("on")) {
// ...
}


Edoardo




--
[EMAIL PROTECTED]
AIM: edoardopn
Jabber: [EMAIL PROTECTED]
tel:075 9142766

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



R: "if" don't work?!?!?

2007-05-22 Thread Massimiliano PASQUALONI
ya 

-Messaggio originale-
Da: Propes, Barry L [mailto:[EMAIL PROTECTED] 
Inviato: martedì 22 maggio 2007 17.04
A: Tomcat Users List
Oggetto: RE: "if" don't work?!?!?

 if (Pippo.equals(Pluto)) maybe?

-Original Message-
From: Massimiliano PASQUALONI
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 22, 2007 9:40 AM
To: 'Tomcat Users List'
Subject: "if" don't work?!?!?


Hi guy!
 
Wat's happen??
 
If i read an checkrequest post

String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 

   if (Pippo == "on") {



}

these don't work
 
And is'nt the first time, 
 
if I try
 
Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");
 
the if (Pippo == Pluto )  don't work!
 
 
 
:-(
 
please, help me!

Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO" 
torre D
70010 CASAMASSIMA (BA)

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Scanned with Copfilter Version 0.83beta3a (ProxSMTP 1.4)
AntiVirus: ClamAV 0.88.4/3281 - Tue May 22 10:50:43 2007
by Markus Madlener @ http://www.copfilter.org

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: "if" don't work?!?!?

2007-05-22 Thread Propes, Barry L
 if (Pippo.equals(Pluto)) maybe?

-Original Message-
From: Massimiliano PASQUALONI
[mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 22, 2007 9:40 AM
To: 'Tomcat Users List'
Subject: "if" don't work?!?!?


Hi guy!
 
Wat's happen??
 
If i read an checkrequest post

String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 

   if (Pippo == "on") {



}

these don't work
 
And is'nt the first time, 
 
if I try
 
Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");
 
the if (Pippo == Pluto )  don't work!
 
 
 
:-(
 
please, help me!

Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO" 
torre D
70010 CASAMASSIMA (BA)

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



R: "if" don't work?!?!?

2007-05-22 Thread Massimiliano PASQUALONI
No, don't work!

Im try a simple function in my javabean that "convert" from string to
boolean:

JSP:
String Prova = request.getParameter("abilitato");
 // where abilitato is a checkbox in a form





Javabean:

public boolean StringToBoolean(String StrBool)
 {
boolean convertito=false;

if ((StrBool == "1") || (StrBool == "On") || (StrBool ==
"on") || (StrBool == "Yes") || (StrBool == "yes") || (StrBool == "Si") ||
(StrBool == "si") || (StrBool == "True") || (StrBool == "true"))
{
convertito = true;
}

if ((StrBool == "0") || (StrBool == "Off") || (StrBool ==
"off") || (StrBool ==   "No") || (StrBool == "no") || (StrBool == "False")
|| (StrBool == "false"))
{
convertito = false;
}

return convertito;
 }
 







If I try 

if ("on".equals(request.getParameter("abilitato"))){
Abilitato = true;
}



Or 

 if (request.getParameter("abilitato").equals("on")){
Abilitato = true;
}

Or

if (request.getParameter("abilitato") == "on"){
Abilitato = true;
}

Or 
Boolean Abilitato = bean.StringToBoolean(Prova);


I have the same result: don't work..


Yesterday I've try also

Referer = request.getHeader("Referer") 
AltroReferer = request.getHeader("Referer") 

if (Referer == AltroReferer ){...}

And don't work.


:-O




-Messaggio originale-
Da: Edoardo Panfili [mailto:[EMAIL PROTECTED] 
Inviato: martedì 22 maggio 2007 16.44
A: Tomcat Users List
Oggetto: Re: "if" don't work?!?!?

Massimiliano PASQUALONI ha scritto:
> Hi guy!
>  
> Wat's happen??
>  
> If i read an checkrequest post
> 
> String Pippo = request.getParameter("abilitato");
> 
> out.print(Pippo);
> 
> return me= on
> 
> If I try to make a condition whit if:
> 
>  
> 
>if (Pippo == "on") {
> 
> 
> 
> }

Maybe possible that I don't understand...

String pippo = request.getParameter("abilitato");
if (pippo.equals("on")) {
// ...
}


Edoardo

--
[EMAIL PROTECTED]
AIM: edoardopn
Jabber: [EMAIL PROTECTED]
tel:075 9142766

-
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Scanned with Copfilter Version 0.83beta3a (ProxSMTP 1.4)
AntiVirus: ClamAV 0.88.4/3281 - Tue May 22 10:50:43 2007
by Markus Madlener @ http://www.copfilter.org

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] "if" don't work?!?!?

2007-05-22 Thread Caldarale, Charles R
> From: Jost Richstein [mailto:[EMAIL PROTECTED] 
> Subject: Re: [OT] "if" don't work?!?!?
> 
> No, that is not guaranteed to be false.
> For example
>Pippo.intern() == Pluto.intern()
> should be true.

The above certainly is correct, but is not what the OP coded.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] "if" don't work?!?!?

2007-05-22 Thread Jost Richstein

No, that is not guaranteed to be false.
For example

  Pippo.intern() == Pluto.intern()

should be true.

Caldarale, Charles R schrieb:
From: Massimiliano PASQUALONI 
[mailto:[EMAIL PROTECTED] 
Subject: "if" don't work?!?!?


   if (Pippo == "on") {



Guaranteed to be false.

  

Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");
 
the if (Pippo == Pluto )  don't work!



Also guaranteed to be false.

You need to learn Java before embarking on writing webapps for any
container.  The test you're making is one for object equality, not
content equality.  Your expression should be something like:

if (Pippo.equals("on"))

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  


--
Jost Richstein
SoftDeCC Software GmbH
Email: [EMAIL PROTECTED]
Tel.: +49 89 89 06 78 47
Fax.: +49 89 89 06 78 33

SoftDeCC Software GmbH; Gesellschaft mit beschränkter Haftung; Sitz der 
Gesellschaft: München; Registergericht: München, HRB 123667; Geschäftsführer: 
Ralf Malis, Georg Nüssel, Jost Richstein, Gerd Wilts



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OT: "if" don't work?!?!?

2007-05-22 Thread DJohnson
This is not really a Tomcat question, but a matter of Java language 
understanding.
Comparators like ==, >, <=, etc. should only be used with java language 
primitive types, such as int, byte, boolean, and NOT with Objects, like 
String, as you are, UNLESS you actually wish to test whether the two 
things you are comparing are the same object instance.  To test whether 
two distinct objects represent the same value or entity, use the equals 
method.  So in your case, you should use:

if (Pippo.equals("on")) { ... }

or 

if (Pippo.equals(Pluto)) { ... }



Please respond to "Tomcat Users List" 

To: "'Tomcat Users List'" 
cc:  
Subject:"if" don't work?!?!?


Hi guy!

Wat's happen??

If i read an checkrequest post

String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:



if (Pippo == "on") {



}

these don't work

And is'nt the first time,

if I try

Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");

the if (Pippo == Pluto )  don't work!



:-(

please, help me!

Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO"
torre D
70010 CASAMASSIMA (BA)




Re: "if" don't work?!?!?

2007-05-22 Thread David Delbecq
Basics of java programming: == operator compare objet instances, not
their content.
To check if 2 differences instance are the same, use the equals() method.
Eg:

if (Pippo.equals("on")) {
...
}

You should probably start by learning java language (J2SE) before you
start learning java enterprise (J2EE).

En l'instant précis du 22/05/07 16:39, Massimiliano PASQUALONI
s'exprimait en ces termes:
> Hi guy!
>  
> Wat's happen??
>  
> If i read an checkrequest post
>
> String Pippo = request.getParameter("abilitato");
>
> out.print(Pippo);
>
> return me= on
>
> If I try to make a condition whit if:
>
>  
>
>if (Pippo == "on") {
>
> 
>
> }
>
> these don't work
>  
> And is'nt the first time, 
>  
> if I try
>  
> Pippo =  request.getParameter("abilitato");
> Pluto =  request.getParameter("abilitato");
>  
> the if (Pippo == Pluto )  don't work!
>  
>  
>  
> :-(
>  
> please, help me!
>
> Massimiliano PASQUALONI
>
> Data Processing S.r.l.
> Reparto EDP
> S.S. 100 BA-TA Km 18
> c/o "IL BARICENTRO" 
> torre D
> 70010 CASAMASSIMA (BA)
>
>   


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] "if" don't work?!?!?

2007-05-22 Thread Caldarale, Charles R
> From: Massimiliano PASQUALONI 
> [mailto:[EMAIL PROTECTED] 
> Subject: "if" don't work?!?!?
> 
>if (Pippo == "on") {

Guaranteed to be false.

> Pippo =  request.getParameter("abilitato");
> Pluto =  request.getParameter("abilitato");
>  
> the if (Pippo == Pluto )  don't work!

Also guaranteed to be false.

You need to learn Java before embarking on writing webapps for any
container.  The test you're making is one for object equality, not
content equality.  Your expression should be something like:

if (Pippo.equals("on"))

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: "if" don't work?!?!?

2007-05-22 Thread Edoardo Panfili

Massimiliano PASQUALONI ha scritto:

Hi guy!
 
Wat's happen??
 
If i read an checkrequest post


String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 


   if (Pippo == "on") {




}


Maybe possible that I don't understand...

String pippo = request.getParameter("abilitato");
if (pippo.equals("on")) {
// ...
}


Edoardo

--
[EMAIL PROTECTED]
AIM: edoardopn
Jabber: [EMAIL PROTECTED]
tel:075 9142766

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: "if" don't work?!?!?

2007-05-22 Thread Jost Richstein

Have you tried

  if("on".equals(Pippo)) {
  
  }

Massimiliano PASQUALONI schrieb:

Hi guy!
 
Wat's happen??
 
If i read an checkrequest post


String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 


   if (Pippo == "on") {




}

these don't work
 
And is'nt the first time, 
 
if I try
 
Pippo =  request.getParameter("abilitato");

Pluto =  request.getParameter("abilitato");
 
the if (Pippo == Pluto )  don't work!
 
 
 
:-(
 
please, help me!


Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO" 
torre D

70010 CASAMASSIMA (BA)

  


--
Jost Richstein
SoftDeCC Software GmbH
Email: [EMAIL PROTECTED]
Tel.: +49 89 89 06 78 47
Fax.: +49 89 89 06 78 33

SoftDeCC Software GmbH; Gesellschaft mit beschränkter Haftung; Sitz der 
Gesellschaft: München; Registergericht: München, HRB 123667; Geschäftsführer: 
Ralf Malis, Georg Nüssel, Jost Richstein, Gerd Wilts



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



"if" don't work?!?!?

2007-05-22 Thread Massimiliano PASQUALONI
Hi guy!
 
Wat's happen??
 
If i read an checkrequest post

String Pippo = request.getParameter("abilitato");

out.print(Pippo);

return me= on

If I try to make a condition whit if:

 

   if (Pippo == "on") {



}

these don't work
 
And is'nt the first time, 
 
if I try
 
Pippo =  request.getParameter("abilitato");
Pluto =  request.getParameter("abilitato");
 
the if (Pippo == Pluto )  don't work!
 
 
 
:-(
 
please, help me!

Massimiliano PASQUALONI

Data Processing S.r.l.
Reparto EDP
S.S. 100 BA-TA Km 18
c/o "IL BARICENTRO" 
torre D
70010 CASAMASSIMA (BA)