Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't find the error

 
Agnit Chatterjee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please tell me where is the error?



I get the following error:


An error occurred at line: 13 in the jsp file: /fdmonitorprops.jsp
String literal is not properly closed by a double-quote
10: Class.forName("oracle.jdbc.driver.OracleDriver");
11: Connection conn3=DriverManager.getConnection("jdbcracle:thin:@Agnit-PC:1521:devdb","system","bababobby");
12: PreparedStatement ps3=conn3.prepareStatement
13: ("select fdaccountno,customerid,amount,interest,to_char(account_start_date),duration,to_char(maturityday),
14: case
15: when (sysdate-maturityday) > 0 then 'matured'
16: when (sysdate-maturityday) = 0 then 'maturityday'


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:95)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:345)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:342)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 
Brett Maclean
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Agnit,

You just need to concatenate the prepared statement string properly. The way I'd do it is to create the string first, e.g.


and then plonk it in to the method of your connection.

HTH
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The obnoxious guy in me wants to point out that the error is to use Java code in JSPs.
 
Brett Maclean
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should always free your inner obnoxious guy :-). But yes good point.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65113
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree: step 1 of fixing any such error is to stop writing JSPs as if it were 2001 and to refactor the Java code into Java classes where it belongs. It's 2011. Time to progress...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic