Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

problem in jsp page

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
this is my program
i want insert the data from jsp page when ever i am excuting the this i am getting following error


http://localhost:8082/ServletProject/sample.html is url the o/p is like following
Book Entry Form

Id: 1
Book Name: java
Author: weeee

submit -->button when i click on submit button i am getting following 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: 2 in the jsp file: /BookEntryForm.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Documents and Settings\admin\workspace\ServletProject\work\org\apache\jsp\BookEntryForm_jsp.java:54: ')' expected



An error occurred at line: 2 in the jsp file: /BookEntryForm.jsp

Generated servlet error:
String url=("jdbc racle:thin:@localhost:1521:xe","system","remora");
^



An error occurred at line: 2 in the jsp file: /BookEntryForm.jsp

Generated servlet error:
C:\Documents and Settings\admin\workspace\ServletProject\work\org\apache\jsp\BookEntryForm_jsp.java:66: unclosed string literal
stmt.executeUpdate("insert into books_details(id,book_name,author) values('"+id+"','"+bookname+"','"+author+"');
^



An error occurred at line: 2 in the jsp file: /BookEntryForm.jsp

Generated servlet error:
C:\Documents and Settings\admin\workspace\ServletProject\work\org\apache\jsp\BookEntryForm_jsp.java:67: ')' expected
rst=stmt.executeQuery("select * from books_details");
^



An error occurred at line: -1 in the jsp file: null

Generated servlet error:
C:\Documents and Settings\admin\workspace\ServletProject\work\org\apache\jsp\BookEntryForm_jsp.java:112: 'catch' without 'try'
} catch (Throwable t) {
^
C:\Documents and Settings\admin\workspace\ServletProject\work\org\apache\jsp\BookEntryForm_jsp.java:31: 'try' without 'catch' or 'finally'
try {
^
C:\Documents and Settings\admin\workspace\ServletProject\work\org\apache\jsp\BookEntryForm_jsp.java:124: '}' expected
^
6 errors


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:315)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:406)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:463)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.25 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.25




i know this is very big to check
but i am uable to excute the program properly
how can i resolve the problem
please any one help me in this program
[ April 10, 2008: Message edited by: Ulf Dittmer ]
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error messages point to at least two problems: the "stmt.executeUpdate" statement is missing a closing parenthesis, and the string that statement is trying to execute isn't properly closed.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remove braces in String URL
check the quotes in the update statement

it is clearly mentioned in the error itself
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Keep the following steps in try block. stmt.executeUpdate may throw SQLException and that should be handled.

stmt.executeUpdate("insert into books_details(id,book_name,author) values('"+id+"','"+bookname+"','"+author+"');
rst=stmt.executeQuery("select * from books_details");

use finally block to close the connection, resultset etc..If possible keep try catch for them also like
finally
{
try
{
conn.close();
....
}
catch()
.............
}
 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic