当前位置:编程学习 > JAVA >>

String literal is not properly closed by a double-quote

请看下是那的问题,谢谢
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: 12 in the jsp file: /mytest/login_conf.jsp
Generated servlet error:
String literal is not properly closed by a double-quote


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.

login_conf.jsp文件:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<head>
        <title>JSP+JDBC 留言管理程序——登陆</title>
</head>
<body>
<center>
        <h1>留言管理范例 —— JSP + JDBC实现</h1>
        <hr>
        <br>
        <%
                String DBDRIVER                 = "oracle.jdbc.driver.OracleDriver" ;
                String DBURL                    = "jdbc:oracle:thin:@192.168.1.25:1521:ora10g;
                String DBUSER                   = "system" ;
                String DBPASSWORD               = "12345" ;
                Connection conn                 = null ;
                PreparedStatement pstmt = null ;
                ResultSet rs                    = null ;
        %>
        <%
                // 声明一个boolean变量,用于保存用户是否合法的状态
                boolean flag = false ;

                // 接收参数
                String id = request.getParameter("id") ;
                String password = request.getParameter("password") ;
        %>
        <%
                String sql = "SELECT name FROM person WHERE id=? and password=?" ;
                try
                {
                        Class.forName(DBDRIVER) ;
                        conn = DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD) ;
                        pstmt = conn.prepareStatement(sql) ;
                        pstmt.setString(1,id) ;
                        pstmt.setString(2,password) ;
                        rs = pstmt.executeQuery() ;
                        if(rs.next())
                        {
                                // 用户合法
                                flag = true ;
                                // 将用户名保存在session之中
                                session.setAttribute("uname",rs.getString(1)) ;
                        }
                        else
                        {
                                // 保存错误信息
                                request.setAttribute("err","错误的用户名及密码!!!") ;
                        }
                        rs.close() ;
                        pstmt.close() ;
                        conn.close() ;
                }
                catch(Exception e)
                {}
        %>
        <%
                // 跳转
                if(flag)
                {
                        // 用户合法
        %>
                        <jsp:forward page="login_success.jsp"/>
        <%
                }
                else
                {
                        // 用户非法
        %>
                        <jsp:forward page="login.jsp"/>
        <%
                }
        %>
</center>
</body>
</html>
--------------------编程问答--------------------
引用
String literal is not properly closed by a double-quote


这个错误:string字串没有以双引号结束

String DBURL = "jdbc:oracle:thin:@192.168.1.25:1521:ora10g";
这句最后面少一个双引号



--------------------编程问答--------------------
引用 1 楼 kouyisc 的回复:
引用
String literal is not properly closed by a double-quote


这个错误:string字串没有以双引号结束

String DBURL = "jdbc:oracle:thin:@192.168.1.25:1521:ora10g";
这句最后面少一个双引号


+++


补充:Java ,  Web 开发
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,