This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Can't find the error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Can Watch "Can New topic
Author

Can't find the error

Agnit Chatterjee
Greenhorn

Joined: Mar 04, 2011
Posts: 24
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

Joined: May 01, 2009
Posts: 22
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


http://www.ontruenorth.com
Follow us on Twitter: http://twitter.com/truenorth_buzz
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41029
    
  43
The obnoxious guy in me wants to point out that the error is to use Java code in JSPs.


Ping & DNS - my free Android networking tools app
Brett Maclean
Greenhorn

Joined: May 01, 2009
Posts: 22
You should always free your inner obnoxious guy :-). But yes good point.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60737
    
  65

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...


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't find the error
 
Similar Threads
JSP Problem
Help in using bean inside JSP
JSP error again
JDBC with OAS
doubt in Session parameters