Home Answers Viewqa Java-Beginners Showing Error for Prepared stmt in a jsp

 
 


M.Santosh kumar
Showing Error for Prepared stmt in a jsp
0 Answer(s)      5 months and 5 days ago
Posted in : Java Beginners

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









Related Pages:
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
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
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
Usage of setDate() in prepared Statement - JDBC
Usage of setDate in prepared Statement  Hi, I have created a jsp...() of prepared statement,the following error is displayed: setDate() not available in prepared statement. Basically, I need to accept the date dynamically
prepared statement in for loop - JDBC
prepared statement in for loop  Hi all, I am reding data from a jsp page and inserting into a table. For this i am using prepared statement...: sun.jdbc.odbc.JdbcOdbcBatchUpdateException: General error
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
jsp error - JSP-Servlet
jsp error  Hello, my name is sreedhar. i wrote a jsp application... and showing the data base code and the connecction code. please help me to come... in detail. Visit for more information. http://www.roseindia.net/jsp/ Thanks
Jdbc prepared statemetn
Jdbc prepared statemetn   I am getting this error when i am compiling this code. java.sql.SQLException: ORA-00904: "PASS": invalid identifier ackage com.jlcindia.bookstore.register; import java.sql.*; import java.util.List
Servlet Error - JSP-Servlet
. Error showing ==>Admin/FirstServlet is not a servlet Sincerely Prakash   Hi prakash servlet-api.jar jsp-api.jar mysql-connector.../lib folder if database is mysql. servlet-api.jar jsp-api.jar mysql-connector
Programming Error - JSP-Servlet
(""); } catch(SQLException se) { out.println("Database Error :"+se.getMessage()); } catch(Exception e) { out.println("General Error :"+e.getMessage... ServletException,IOException {doPost(req,res);} } There is some error
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE  I AM... IT. IT IS SHOWING ERRORS. I TRIED REMOVING THE DELIMITER KEYWORD, BUT IT IS STILL THE SAME. I AM ALSO PUTTING THE GENERATED ERROR. (0 row(s)affected) (0 ms taken) (0 row(s
PDO Prepared Statement
PDO Prepared Statements: In this current tutorial we will study about prepared... for us to use a Prepared Statement for sending SQL statements to the database..., using this we can reduce the execution time. The prepared statement can
error in driver connection
error in driver connection  String driver = "org.gjt.mm.mysql.Driver"; Class.forName(driver).newInstance(); //error at this line Connection con=null; ResultSet rst=null; Statement stmt=null
JSP error
JSP error  what is difference between global-exception and error-page in jsp. which condition they are use
Java runtime error - JSP-Servlet
Java runtime error  Following Error is showing when i way scanner.acquire() can any body help me please...:52) at org.apache.jsp.index_jsp._jspService(index_jsp.java:119
JDBC Prepared Statement Addbatch
JDBC Prepared Statement Addbatch       The code illustrate an example from JDBC Prepared statement... prepared object.7) execute Batch ( ) - This method is used to submit a set
how to add Arraylist filter for a jsp page showing results from a servlet
how to add Arraylist filter for a jsp page showing results from a servlet  hello sir/mam, in my project i have an arraylist showing results in a jsp... visit the following link: http://roseindia.net/jsp/servlet-jsp-data-list.shtml
Integer Auto incremented ID not showing up
Integer Auto incremented ID not showing up  SearchStudent.jsp Student to search into database <script language="javascript">... org.apache.jasper.JasperException: An exception occurred processing JSP page /FoundStudents.jsp at line 58
error : not an sql expression statement
error : not an sql expression statement  hii I am gettin followin error in connecting to database SQLserver 2005 in Jdeveloper,i m usin struts and jsp my pogram: import java.sql.*; public class TaskBO { public TaskBO
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
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"
jsp sessions - JSP-Servlet
jsp sessions  hai deepak this is senthil i have a query that is in my... con; private PreparedStatement stmt; public void sessionCreated... into sessionlog values(?,?,?)"; stmt=con.prepareStatement(sql); } catch(SQLException
java http 404 status error - JSP-Servlet
java http 404 status error  I have tried to call a servlet from html page.. but it is showing http 404 status error.. and the description is "The requested resource is not available". I hav tried in all ways.. Plz give me
jsp error - JSP-Servlet
jsp error  HTTP Status 404 - /jsp... message /jsp/ description The requested resource (/jsp/) is not available..., The 404 or Not Found error message is an HTTP standard response code indicating
java runtime error
program but i am getting the error Exception in thread "main..."; // String url = "jdbc:mySubprotocol:myDataSource"; ? static Statement stmt... { JOptionPane.showMessageDialog(null,"JDBC Programming showing Creation
JSP Error - JSP-Servlet
JSP Error  When i am running my registration.jsp getting following error. HTTP Status 500... description The server encountered an internal error () that prevented it from fulfilling
jsp error - JSP-Servlet
jsp error  how to remove below error:: exception org.apache.jasper.JasperException: java.lang.NullPointerException root cause...... newpo.jsp:   JSP Page
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
jsp error - JSP-Servlet
jsp error  To Upload and insert the file into oracle Database with Current Date and Time In JSP and my project is online library management system plz help how to store some books in particular folder and after how retrive
i am inserting an image into database but it is showing relative path not absolute path
i am inserting an image into database but it is showing relative path not absolute path   hi my first page......... Image Enter your name... got error java.io.filenotfoundexception....... please go through it and help me
i am inserting an image into database but it is showing relative path not absolute path
i am inserting an image into database but it is showing relative path not absolute path   hi my first page......... Image Enter your name... got error java.io.filenotfoundexception....... please go through it and help me
error oracle database connection?
error oracle database connection?  hi now i am trying to connect...; PreparedStatement stmt=null; Connection con =null; ResultSet rs=null... super.destroy(); try { if(stmt!=null
i am inserting an image into database but it is showing relative path not absolute path
i am inserting an image into database but it is showing relative path not absolute path   hi my first page......... <html> <head>... got error "java.io.filenotfoundexception" please go through it and help me
error got minus one from read call - JSP-Servlet
error got minus one from read call  hiiii while connecting my servlet to database im getting error called java.sql.SQLException: Io exception: Got...; Statement stmt = null; ResultSet rs = null; try { Class.forName
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 Translation error - JSP-Servlet
JSP Translation error  Hello friends, In a new file declared first variable shows the following error. ----------------------------------------------- An error occurred at line: 2 in the jsp file: /stud
JScript error - JSP-Servlet
JScript error  Hello friends, I am doing jsp... logins while updating profile it will not show any error. But, in many logins it shows error as unterminated string. I am not able
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
Logic error? HELP PLEASE! :(
Logic error? HELP PLEASE! :(  Hello Guys! i have a huge problem. What I want to do is there is a retrieve jsp page. In the retrieve jsp page..." %> <jsp:useBean id="dataBean" class="sg.edu.nyp.DataBean" scope="session
JSP error page - JSP-Servlet
JSP error page  Hi i have 1000 of JSP. but we coded it without adding... the exception occured in JSP. is there any short cut i can do? do not want to add this line.../DAO/bean layer and not in the JSP. let me know if you have any idea. Thanks
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 error - JDBC
jsp error   in this code the else part is nt executing atall... of that a error is like-----------"java.sql.SQLException: [Microsoft][ODBC Driver Manager... the line is not getting incremented u r getting that error just do this change
java.lang.NullPointerException - JSP-Servlet
. For read more information visit to : http://www.roseindia.net/jsp/prepared...("jdbc:odbc:mydb"); } java.sql.PreparedStatement stmt.......   Hi friend, We check your code having some error and do
jsp runtime error - JSP-Servlet
jsp runtime error  sir, when i am running ur prog... from this website.... http://www.roseindia.net/jsp/poi/readingWriting.shtml i did the same as per guidelines...but i got error..!!!! org.apache.jasper.JasperException
Tomcat error - JSP-Servlet
the error :-this is non microsoft product please see event log . what might be the reason of such error  HI, Can you paste the error log here.We
Script error - JSP-Servlet
running this it shows an error as "STACK OVERFLOW". Correct the code . The code... then send me jsp code. Thanks
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.