• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Can't find the error

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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("jdbc:oracle: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)
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should always free your inner obnoxious guy :-). But yes good point.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
reply
    Bookmark Topic Watch Topic
  • New Topic