无法使用 glass fish server3.1.2 在 netbeans 中编译 jsp,它显示以下异常
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6197: An error occurred at line: 9 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
';' expected
PWC6197: An error occurred at line: 9 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
';' expected
PWC6197: An error occurred at line: 9 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
not a statement
PWC6197: An error occurred at line: 9 in the jsp file: /index.jsp
PWC6199: Generated servlet error:
';' expected
我的 java 和 jsp 代码
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@page language="java" import= "java.sql.*"%>
<%
String driver="org.postgresql.Driver";
Class.forName(driver).newInstance();
Connection con=null;
ResultSet rst=null;
Statement stmt=null;
try
{
String url="jdbc:postgresql://localhost:5432/ksa?user="postgres"password="postgres"";
con=DriverManager.getConnection("url");
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
if(request.getParameter("action")!=null)
{
String name=request.getParameter("name");
String address=request.getParameter("address");
String id=request.getParameter("id");
stmt.executeUpdate("insert into cd values('"+ name +"','"+ address +"')");
rst=stmt.executeQuery("select * from cd");
}
%>
netbeans 显示该行中的错误
String url="jdbc:postgresql://localhost:5432/ksa?user="postgres"password="postgres"";
我使用 postgresql9.1,glassfish 日志显示以下内容
SEVERE: Error compiling file: /home/adapco/.netbeans/7.1.1/config/GF3_1/domain1 /generated/jsp/cddata/org/apache/jsp/index_jsp.java
WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception