<%@page language="java" %>
<HTML>
<BODY>
Hello! Enter stuff and press Log in
<FORM METHOD="POST" ACTION="test.jsp">
<TABLE>
<TR><TD>User name: <INPUT TYPE="TEXT" NAME="username">
<TR><TD> Password: <INPUT TYPE="PASSWORD" NAME="password">
<TR><TH><INPUT TYPE="SUBMIT" VALUE="Log In">
</TABLE>
</FORM>
</HTML>
</BODY>
-----------------------------------------------the login page---
<%@ page language="java" %>
<HTML>
<BODY>
Hello!
<%
String s1=request.getParameter("username");
String s2="leo";
if (s1==s2) {
out.println("<hr><font color=red>You got that right!\nSay again <h1> HA HA HA AH AHA AHAHAHAH AH HA </h1></font>");
}
else {
out.println("<h1> NO NO NO you are not leo </h1>");
out.println("<h1> NO NO NO you are not leo </h1>");
out.println("<h1> NO NO NO you are not leo </h1>"+s1);
}
%>
</HTML>
</BODY>
---------------------------------test page----
no matter what the username value it executes the else part
anyone knows why
[ November 10, 2005: Message edited by: pete duncan ]
<HTML>
<BODY>
Hello! Enter stuff and press Log in
<FORM METHOD="POST" ACTION="test.jsp">
<TABLE>
<TR><TD>User name: <INPUT TYPE="TEXT" NAME="username">
<TR><TD> Password: <INPUT TYPE="PASSWORD" NAME="password">
<TR><TH><INPUT TYPE="SUBMIT" VALUE="Log In">
</TABLE>
</FORM>
</HTML>
</BODY>
-----------------------------------------------the login page---
<%@ page language="java" %>
<HTML>
<BODY>
Hello!
<%
String s1=request.getParameter("username");
String s2="leo";
if (s1==s2) {
out.println("<hr><font color=red>You got that right!\nSay again <h1> HA HA HA AH AHA AHAHAHAH AH HA </h1></font>");
}
else {
out.println("<h1> NO NO NO you are not leo </h1>");
out.println("<h1> NO NO NO you are not leo </h1>");
out.println("<h1> NO NO NO you are not leo </h1>"+s1);
}
%>
</HTML>
</BODY>
---------------------------------test page----
no matter what the username value it executes the else part
anyone knows why
[ November 10, 2005: Message edited by: pete duncan ]