Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in jsp page  RSS feed

 
Geeta Ravikanti
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • 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.
 
Ajith Prasad
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • 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
 
K Kiran Kumar
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • 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()
.............
}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!