Showing Error for Prepared stmt in a jsp

Showing Error for Prepared stmt in a jsp

i hav a task to connect jsp to oracel database using preparestatement and gettin an error showin dat prepared statement obj cant be created pstmt is nt resloved here are the files

index.jsp

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    function validateForm()
    {
    var x=document.forms["myForm"]["Login"].value;
    if (x==null || x=="")
      {
      alert("Login must be filled out");
      return false;
      }
    }
    </script>

    </head>
    <body bgcolor=pink>
    <center><h1>DiggIn</h1>
    <p><b>Welcome to DiggIn</b> </p>
    <form action="Display.jsp" method="post">
    <table width="276" height="74" border="0">
      <tr>
        <td width="60" height="53">Login</td>
         <td>:</td>
        <td width="199"><input type="text" name="Login" /></td>
      </tr>
      <tr>
        <td width="60" height="42">Password</td>
        <td>:</td>
        <td><input type="password" name="Password" /></td>
      </tr>
      <tr>
        <td width="60" height="42">Qualification</td>
        <td>:</td>
        <td><input type="text" name="Qualification" /></td>
      </tr>
      <tr>
        <td width="60" height="42">City</td>
        <td>:</td>
        <td><input type="text" name="City" /></td>
      </tr>
    </table><form action=""><input type="submit" value="SignUp!"></form>
    <form action=""><input type="button" name="SignIn" value="SignIn" /></form>

    </center>
    </form>
    </body>
    </html>

Display.jsp

    <html>
    <head>
    </head>
    <%@ page import="java.sql.*"%>
    <body bgcolor="aqua">
    <center>
    <%
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","abc");
    PreparedStatement pstmt=null;
    String SQL="Insert into Login values(?,?,?,?)";
    pstmt=con.prepareStatement(SQL);
    }
    catch(Exception e){
      e.printStackTrace();
    }
    String Login=request.getParameter("Login");
    String Password=request.getParameter("Password");
    String Qualification=request.getParameter("Qualification");
    String City=request.getParameter("City");
    out.println(Login);
    out.println(Password);
    out.println(Qualification);
    out.println(City);
    pstmt.setString(1,Login);
    pstmt.setString(2,Password);
    pstmt.setString(3,Qualification);
    pstmt.setString(4,City);
    String result=pstmt.executeUpdate();
    %>
    <a href="user.html">Update</a>
    </center>
    </body>
    </html>

    Error:
    HTTP Status 500 - 


type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 26 in the jsp file: /Display.jsp
pstmt cannot be resolved
23: out.println(Password);
24: out.println(Qualification);
25: out.println(City);
26: pstmt.setString(1,Login);
27: pstmt.setString(2,Password);
28: pstmt.setString(3,Qualification);
29: pstmt.setString(4,City);


An error occurred at line: 27 in the jsp file: /Display.jsp
pstmt cannot be resolved
24: out.println(Qualification);
25: out.println(City);
26: pstmt.setString(1,Login);
27: pstmt.setString(2,Password);
28: pstmt.setString(3,Qualification);
29: pstmt.setString(4,City);
30: String result=pstmt.executeUpdate();


An error occurred at line: 28 in the jsp file: /Display.jsp
pstmt cannot be resolved
25: out.println(City);
26: pstmt.setString(1,Login);
27: pstmt.setString(2,Password);
28: pstmt.setString(3,Qualification);
29: pstmt.setString(4,City);
30: String result=pstmt.executeUpdate();
31: %>


An error occurred at line: 29 in the jsp file: /Display.jsp
pstmt cannot be resolved
26: pstmt.setString(1,Login);
27: pstmt.setString(2,Password);
28: pstmt.setString(3,Qualification);
29: pstmt.setString(4,City);
30: String result=pstmt.executeUpdate();
31: %>
32: <a href="user.html">Update</a>


An error occurred at line: 30 in the jsp file: /Display.jsp
pstmt cannot be resolved
27: pstmt.setString(2,Password);
28: pstmt.setString(3,Qualification);
29: pstmt.setString(4,City);
30: String result=pstmt.executeUpdate();
31: %>
32: <a href="user.html">Update</a>
33: </center>


Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
View Answers

Ads









Related Tutorials/Questions & Answers:
Showing Error for Prepared stmt in a jsp
Showing Error for Prepared stmt in a jsp  i hav a task to connect jsp... org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred...=pstmt.executeUpdate(); 31: %> An error occurred at line: 29 in the jsp file
Showing Error for Prepared stmt in a jsp
Showing Error for Prepared stmt in a jsp  i hav a task to connect jsp... org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred...=pstmt.executeUpdate(); 31: %> An error occurred at line: 29 in the jsp file
Advertisements
why the program is showing error?
; It is showing the error: An error occurred at line: 33 in the jsp file...why the program is showing error?  <%@page import="java.sql.*"%>...=Integer.parseInt(rs1.getString(10)); 36: i=i+k; An error occurred at line
compiled but showing below error
compiled but showing below error  Good morning, By using axis api, am getting the following error but the wsdl file is generating. what is the mistake I done. Unable to find required classes (javax.activation.DataHandler
Showing error in the driver declaration.Please suggest
Showing error in the driver declaration.Please suggest  org.apache.jasper.JasperException: Exception in JSP: /LogIn/8June.jsp:15 12: String driver = "org.gjt.mm.mysql.Driver" 13: //String connectionURL = "jdbc:mysql
JSP error
JSP error  what is difference between global-exception and error-page in jsp. which condition they are use
jsp error
jsp error  <p>hi, could please help whenever i run jsp file in my eclipse i got this error.my jsp file is</p> &lt;%@ page language... encountered an internal error () that prevented it from fulfilling this request
JSP SQL Error
JSP SQL Error  Hi While trying to execute the below code i'm getting the following error "java.sql.SQLException: Io exception: Got minus one from a read call ". please help me out. <% try{ String Username
jsp-servelet,error http404
jsp-servelet,error http404  I am using mysql commandclient to connect with eclipse using jsp and servelet. I keep getting the error hhtp 404. Register.jsp Name:<input type="text" name="userName"/><
JSP Error 500
JSP Error 500          JSP Error 500 is to generate error status 500 in jsp.  The Error 500 occurred when the server encounter an internal error
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n tomcat server DSN name : NB Username NB Password EBS Table name consumer When i run jsp page on the browser it only shows the code nothing else.. I have
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n tomcat server DSN name : NB Username NB Password EBS Table name consumer When i run jsp page on the browser it only shows the code nothing else.. I have
JSP Page Error
JSP Page Error  Hello Sir. I m using Oracle 10g as a database n tomcat server DSN name : NB Username NB Password EBS Table name consumer When i run jsp page on the browser it only shows the code nothing else.. I have
Programming error - JSP-Servlet
where if @ is not given or (dot). is not given etc then it should display error
JSP Error Page
JSP Error Page          JSP Error Page is used to specify the custom... directive. The page errorPage.jsp shows the error generated in calling the JSP page
Jsp error when i run this a jsp file
Jsp error when i run this a jsp file  hi I got this error when i run the jsp file in IDE and outside also please help me java.lang.NullPointerException org.apache.jsp.insertjsp.jspInit(insert_jsp.java:22
Dynamin Jfree chart in jsp---error
error details. Have a look at the following link: http://www.roseindia.net/jsp...Dynamin Jfree chart in jsp---error   While compiling this CODE...("Problem in creating chart."); } %> Generated error: <
Insert data in mysql database through jsp using prepared statement
Insert data in mysql database through jsp using prepared statement...; This is detailed jsp code that how to insert data into database by using prepared statement...; Save this code as a .jsp file named "prepared_statement_query.jsp"
Error page in JSP
Error page in JSP In this section we will discuss about "Error page... the JSP page a runtime error may occur inside the page or outside the page. JSP... in the directive in the originating JSP page by setting error page parameter like
Error testing in JSP
Error testing in JSP       This section illustrates you about the error testing in jsp. In JSP, you..." %>. The JSP page where the exception can occur specifies the error page name
ModuleNotFoundError: No module named 'morningstar-stmt'
named 'morningstar-stmt' error? Thanks   Hi, In your...: No module named 'morningstar-stmt' error will be solved. Thanks...ModuleNotFoundError: No module named 'morningstar-stmt'  Hi, My
error while running a jsp page in netbeans
error while running a jsp page in netbeans  this is error that come under column "java db processes" in netbeans Exception in thread "main" java.lang.ExceptionInInitializerError
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it
Insert data in mysql database through jsp using Prepared Statement ---- Please...;Please visit the following link: http://www.roseindia.net/jsp/prepared-statement... processing JSP page /databaseinsertion.jsp at line 117 114: 115: finally
JSP error: class UserForm not found in class model.UserAction
JSP error: class UserForm not found in class model.UserAction  etting the following error in the program..wat shod i do to remove this?I am using jdeveloper 10 g [code] package model; import javax.servlet.http.HttpServletRequest
Insert data in mysql database through jsp using Prepared Statement ---- Please Resolve it
Insert data in mysql database through jsp using Prepared Statement ---- Please... link: http://www.roseindia.net/jsp/prepared-statement-query.shtml   ... occurred processing JSP page /databaseinsertion.jsp at line 117 114: 115
Error in reading Excel data using jsp
Error in reading Excel data using jsp  ERROR while executing bellow...() method shows the following Error message on console...) at org.apache.jsp.AdminSaaS.excelreading_jsp._jspService(excelreading_jsp.java:71
How to create and use custom error page in jsp
How to create and use custom error page in jsp... and use custom error page in jsp and display an error message. Before run... as a .jsp file named "error_page.jsp" in the directory
jQuery auto complete through database using JSP shows error
jQuery auto complete through database using JSP shows error  The tutorial on jQuery titled "jQuery auto complete through database using JSP" shows error on browser when I try to select the one in the dropdown. Please help
prepared statement
prepared statement  plese give me a code that have preparedstatement interface and uses a select query having condition date="s"; where s is the date, but this date parameter passed as the string
validating credentials and displaying error message in login .jsp if not valid
validating credentials and displaying error message in login .jsp if not valid  hi, i want to validate user name and password against my database table if not valid i have to display error message in my login page.how to do
Programming Error - JSP-Servlet

Ads