Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: check the code, have some errors!!!!URGENT


Message #1 by "Pallavi Mahajan" <paluindian@r...> on Sun, 22 Apr 2001 22:31:00
String u1 = null;
String p1 = null;
String s1 = null;
String m1 = null;
String R1 = null;

Regards
Ngan Kok Kie, Roy
(Web Developer)
Next Synthesis Sdn. Bhd. (447347-H)


----- Original Message -----
From: "Pallavi Mahajan" <paluindian@r...>
To: "Pro_JavaServer_Pages" <pro_jsp@p...>
Sent: Sunday, April 22, 2001 10:31 PM
Subject: [pro_jsp] check the code, have some errors!!!!URGENT


> Hello friends,
> Hey i've written code for checking the password entered , but dont know
why its giving me
> lotta errors. I'm gving the code below, please tell me where I'm wrong...
>
> I'm preapring the messageboard...
>
>
>
>
> <html>
> <head>
> </head>
> <%@ page language="java"
>   info="PALLAVI's Assignment 2"
>   contentType="text/html"
>   import="java.lang.Integer, java.util.Vector, java.util.*"
> %>
> <%@ page import="java.util.*"%>
> <%@ page import="java.awt.*"%>
> <%@ page import="java.sql.*"%>
>
> <%!//declare variables
>
> String u1;
> String p1 ;
> String s1 ;
> String m1 ;
> String R1 ;
>
> %>
>
> <body>
> <%
>
> try {
>
>    u1 = request.getParameter("UserName");
>
>
>    p1 = request.getParameter("Password");
>    s1 = request.getParameter("subject");
>
>    m1 = request.getParameter("text");
>
>
>    }catch (Exception e){
> out.print("Sorry some exception has kkl kk been thrown!!");
>    }
> %>
>
>
>
> <p>Material Selected is:  <b><%=u1 %></b> </p>
>  <p>The Status of the User is : <b><%=p1 %></b></p>
>
> <p>The Status of the User is : <b><%=s1 %></b></p>
> <p>The Status of the User is : <b><%=m1 %></b></p>
>
>
> <%
> try{
> %>
> <%
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> Connection
con=DriverManager.getConnection("jdbc:odbc:MsgBoardODBC","admin","admin");
> Statement stmt=con.createStatement();
> ResultSet rs= stmt.executeQuery("Select Password from Entry_tbl where
> UserName='pallavi'");
>
> }
> catch(Exception e){
> System.out.println(e);
> }
> %>
>
> <%
> while(rs !=null)
> {
> while(rs.next())
> {
> String p2=rs.getString("Password");
> }
> }
> %>
>
> <%
> if(p2.equals(p1))
> {
> out.println("operation sucessful");
> }
> %>
>
> <%
> rs.close();
> con.close();
> %>
>
> </body>
> </html>
>
>
>
>
>
>
> errors are
>
>
>
>
>
> 500 Internal Server Error
> Java Server Page Translation Error
> Error during compilation :
> C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_sendmail.java:150:
Undefined variable:
> rs
>                 while(rs !=null)
>                       ^
> C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_sendmail.java:152:
Undefined variable
> or class name: rs
>                 while(rs.next())
>                       ^
> C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_sendmail.java:154:
Undefined variable
> or class name: rs
>                 String p2=rs.getString("Password");
>                           ^
> C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_sendmail.java:161:
Undefined variable
> or class name: p2
>                 if(p2.equals(p1))
>                    ^
> C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_sendmail.java:169:
Undefined variable
> or class name: rs
>                 rs.close();
>                 ^
> C:\JavaWebServer2.0\tmpdir\default\pagecompile\jsp\_sendmail.java:170:
Undefined variable
> or class name: con
>                 con.close();
>                 ^
> 6 errors
>
>
>
> I've defined variables then aslo its giving me erors, why???
> Entry_tble has two frids UserName and Password.
> DSN is corect cuz it worls ptherwise.
> Please tell me soon.
> Bye
> Pallavi
> 

  Return to Index