How to compare a string ?

I have the following codes passed form a selection page(radiobutton). Value of first radio button is

'Stringent' while value of second radio button is 'Loose'.

<%

if(request.getParameter("match")!=null)

{

String matchopt = (String)request.getParameter("match");

if(matchopt=="Stringent")

{

out.println("Stringent Match");

}

else

{

out.println("Loose Match");

}

}

else

{

out.println("No option selected");

}

%>

--

The result is I always get the answer of Loose Match either I select Stringent Match or Loose Match

radio button. I have tried to print out the value pass over and it is correct.

Anyone know how to compare the string?

[807 byte] By [jeffkyt79] at [2007-9-26 13:45:08]
# 1
String matchopt = (String)request.getParameter("match");if(matchopt=="Stringent"){ out.println("Stringent Match"); Instead of == useif (matchopt.equals("Stringent")){
rpaturi at 2007-7-2 14:34:51 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...