Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Displaying messages


Message #1 by "Johan Ruttens" <ruttens_johan@h...> on Fri, 11 May 2001 08:44:12
 You can see the following example

<!--Login.jsp-->
<%
  String adminPwd = "apache"; // You password
  String pwd = request.getParameter("pwd");

  if ((pwd != null) && pwd.equals(adminPwd))
  {
      session.setAttribute("wasLogin", "OK");
      response.sendRedirect("anotherPage.jsp");
   }
  else if (pwd != null)
    out.println("<center>You've entered a wrong password!</center>");

%>
<HTML>
<HEAD>
  <TITLE>Login</TITLE>
</HEAD>
<BODY>
<CENTER>
  <H1>Login Page</H1>
  <FORM method="get" action="login.jsp">
    <BR>Password : <INPUT TYPE="password" NAME="pwd">
    <BR><BR>
    <INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Login">
  </FORM>
</CENTER>
</BODY>
</HTML>



> Hi,
> 
> I've made a JSP login page, with a Java Bean, if the user doesn't type
> in 
> the rigth password and/or username, I let the login page return to
> itself.
> 
> Is it possible to display a message (for example "Invalid password")
> when 
> the login page gets displayed a second time?



  Return to Index