tigersbite
Programmer
Ok, this is really bugging me because it should work. My sample test.jsp is as follows:
<html>
<head>
<title>Test getParameter Page</title>
</head>
<body>
<% String myString = request.getParameter("fName" %>
<% if (myString == "Sam" { %>
Hello There, <%= myString %>.
<% } else { %>
You're not Sam! You entered <%= myString%>.
<% } %>
</body>
</html>
I put the script in my server's root. The url I entered is:
Page processes fine, but my output is:
You're not Sam! You entered Sam.
Obviously the parameter is being passed to the script. Why isn't the string comparing correctly to the literal? Is there something I'm missing here? Thanks in advance.
<html>
<head>
<title>Test getParameter Page</title>
</head>
<body>
<% String myString = request.getParameter("fName" %>
<% if (myString == "Sam" { %>
Hello There, <%= myString %>.
<% } else { %>
You're not Sam! You entered <%= myString%>.
<% } %>
</body>
</html>
I put the script in my server's root. The url I entered is:
Page processes fine, but my output is:
You're not Sam! You entered Sam.
Obviously the parameter is being passed to the script. Why isn't the string comparing correctly to the literal? Is there something I'm missing here? Thanks in advance.