tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edoardo Panfili <edoa...@aspix.it>
Subject Re: R: "if" don't work?!?!?
Date Tue, 22 May 2007 15:05:30 GMT
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
<input name="abilitato" value="si" type="checkbox">
?
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:edoardo@aspix.it] 
> 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
> 


-- 
edoardo@aspix.it
AIM: edoardopn
Jabber: edoardopa@talk.google.com
tel:075 9142766

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


Mime
View raw message