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: "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: "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]



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: "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]