yiannakop
September 15th, 2004, 05:37 PM
Hi everyone. I 've just started learning jsp. I am reading a couple of tutorials and I made 2 jsps:
LoginPage.jsp:
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
<h2>Login</h2>
<form method=get action="AfterLogin.jsp">
<table>
<tr><td>Username</td><td><input type=text name=username></td></tr>
<tr><td>Password</td><td><input type=password name=password></td></tr>
</table>
<p></p>
<input type=submit name=operation value="Login">
</form>
</body>
</html>
AfterLogin.jsp:
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
<%
String myName = request.getParameter("username");
String myPass = request.getParameter("password");
if ((myName.equals("theodore"))&&(myPass.equals("12345")))
{
out.print ("<table><TR><TD><font size = 5>Welcome Theodore!!!</font></TD>");
}
else
{
out.print("Wrong user name or password\n");
out.print("<a href=LoginPage.jsp><font size=\"5\">Back to Login Page</font>");
}
%>
</body>
</html>
The thing works fine, but if the problem is that in the address bar there is sth like:
http://localhost:8081/sgouros1/AfterLogin.jsp?username=theodore&password=1235&operation=Login
Is there any way to avoid displaying of the "request" parameters in the address bar?
Thanx for your answers
LoginPage.jsp:
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
<h2>Login</h2>
<form method=get action="AfterLogin.jsp">
<table>
<tr><td>Username</td><td><input type=text name=username></td></tr>
<tr><td>Password</td><td><input type=password name=password></td></tr>
</table>
<p></p>
<input type=submit name=operation value="Login">
</form>
</body>
</html>
AfterLogin.jsp:
<%@page contentType="text/html"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
<%
String myName = request.getParameter("username");
String myPass = request.getParameter("password");
if ((myName.equals("theodore"))&&(myPass.equals("12345")))
{
out.print ("<table><TR><TD><font size = 5>Welcome Theodore!!!</font></TD>");
}
else
{
out.print("Wrong user name or password\n");
out.print("<a href=LoginPage.jsp><font size=\"5\">Back to Login Page</font>");
}
%>
</body>
</html>
The thing works fine, but if the problem is that in the address bar there is sth like:
http://localhost:8081/sgouros1/AfterLogin.jsp?username=theodore&password=1235&operation=Login
Is there any way to avoid displaying of the "request" parameters in the address bar?
Thanx for your answers