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