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