Try to use request.getParameter("..").toString(); in both name and chk
variables.

Regards

Fran Martinez


> -----Mensaje original-----
> De:   [Vaishali S. Pandya] [SMTP:[EMAIL PROTECTED]]
> Enviado el:   viernes 3 de mayo de 2002 11:15
> Para: [EMAIL PROTECTED]
> Asunto:       pls try and tell me why not working
>
> hello.jsp
> ------------
> <html>
> <head><title>Hello User</title></head>
> <script language = "javascript">
>      function getfocus(){
>           document.hello.username.focus();
>      }
>      function submit1(){
>           document.hello.action="hello.jsp?check=1"
>           document.hello.submit()
>      }
>      function reset1(){
>           document.hello.action="hello.jsp?check=0"
>           document.hello.submit()
>      }
> </script>
> <body bgcolor="#ffffff" onload = "getfocus()">
> <table border="0" width="700">
> <h1>
> <font color = pink>
> <marquee>
> Hi! I am Vaishali. Who are you?
> </marquee>
> </h1>
> <form  name="hello" method="Post" action="hello.jsp">
> <input type="text" name="username" size="25"><br>
> <input type="submit" name=submit value="Submit" onclick="submit1()">
> <input type="submit" name= reset value="Reset" onclick="reset1()">
> <input type=hidden name = "check" value = "1">
> <%
>      String name = request.getParameter("username");
>      String chk  = request.getParameter("check");
>      if (name != null && chk != null){
>           name = name.trim();
>           if (!(name.equals("")) && (chk.equals("1"))){
> %>
>                <br>
>                Hello <%=name%>
> <%
>           }
>      }
> %>
> </form>
> </font>
> </table>
> </body>
> </html>
>
>
>
>
> login.jsp
> ------------
> <html>
> <head><title> Login Window </title></head>
> <script language = "javascript">
>      function getfocus(){
>           document.login.user.focus();
>      }
>      function submit1(){
>           document.login.action="login.jsp?check=1";
>           document.login.submit();
>      }
>      function reset1(){
>           document.login.user.value="";
>           document.login.pword.value="";
>           document.login.action="login.jsp?check=0";
>           document.login.submit();
>      }
> </script>
> <body onload = "getfocus()">
> <form  name="login" method="Post" action="login.jsp">
> <center>
> <TABLE>
>      <TR>
>           <TD>Login</TD>
>           <TD><INPUT TYPE="text" NAME="user" value=""></TD>
>      </TR>
>      <TR>
>           <TD>Password</TD>
>           <TD><INPUT TYPE="password" NAME="pword" value=""></TD>
>      </TR>
>      <TR>
>           <TD><INPUT TYPE="submit" name=submit value="Submit" onclick
> ="submit1()"></TD>
>           <TD><INPUT TYPE="submit" name=reset value="Reset"
> onclick="reset1
> ()"></TD>
>      </TR>
> </TABLE>
> </center>
> <input type=hidden name = "check" value = "1">
>
> <%
>      String user = request.getParameter("user");
>      String pword = request.getParameter("pword");
>      String chk = request.getParameter("check");
>      if(user != null && pword != null && chk != null){
>           if (chk.equals("0")){
> %>
> <script>
>                getfocus();
> </script>
> <%
>           }
>           else{
>                user = user.trim();
>                if (!(user.equals(""))){
>                     if (user.equals("ril") && pword.equals("india")){
> %>
> <script>
>                          alert("Yes! You have done it!!!");
>                          document.login.action="hello.jsp"
>                          document.login.submit()
> </script>
> <%
>                     }
>                     else{
> %>
>                          Sorry! Wrong User name or Password!!!
> <%
>                     }
>                }
>           }
>      }
> %>
> </form>
> </body>
> </html>
>
>
>
> --------------
> i am opening login.jsp
> gives ril and india
> it gives me alert but hello.jsp is not opening and gives me
>
> Done, but with error on page.
>
> Thanks
> Vaishali
> Reliance Ind. Ltd
> Ahmedabad
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to