aspose file tools*
The moose likes JSP and the fly likes Error: String literal is not properly closed by a double-quote Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Error: String literal is not properly closed by a double-quote" Watch "Error: String literal is not properly closed by a double-quote" New topic
Author

Error: String literal is not properly closed by a double-quote

Rekha Bhuvanagiri
Greenhorn

Joined: Oct 01, 2012
Posts: 1
Hi,
while compiling the jsp in tomcat i got thie error , can anyone resolve it . Thanks in advance..

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 15 in the jsp file: /reg.jsp
String literal is not properly closed by a double-quote
12: "root","root");
13: Statement st= con.createStatement();
14: ResultSet rs;
15: int i=st.executeUpdate("insert into users(user,pwd,fname,lname,email) "+ " values ('"+user+"','"+pwd+"','"+fname+"',
16: '"+lname+"','"+email+"')");
17:
18:


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

This means you have a syntax error in the Java code in your JSP.

Modern JSPs should not have any Java code in them. Your best action is to refactor the Java code into a Java class and not in the JSP.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1027
And while you're doing that, you can eliminate sql injection vulnerabilities by using a Prepared statement rather than building up a sql string.
The side effect of that will be to simplify your sql string so that you don't need to do string concatenation over multiple lines.
 
 
subject: Error: String literal is not properly closed by a double-quote