【发布时间】:2020-07-04 19:05:39
【问题描述】:
我正在为我在大学的班级做一个 Web 应用程序项目,它包括一个表,我必须在其中读取 Java Derby DB 中的数据,但是在我将一些 Java 代码添加到jsp 文件。我已经尝试过另一种方法,但最终导致内部服务器错误,我在这里真的很沮丧,希望有人可以帮助我。
项目尚未完成,缺少一些代码我没有添加代码来显示结果。
我也找不到任何对错误消息有帮助的东西:“非法字符:'\u200c'”
我正在使用带有 derbyDB 和 JaveEE 的 Netbeans
出现错误的那一行是我开始上课的那一行
<%!public class Customer{
错误: HTTP 状态 500 - 内部服务器错误 输入异常报告
消息内部服务器错误
描述服务器遇到了一个内部错误,导致它无法完成这个请求。
异常
org.apache.jasper.JasperException: PWC6033: JSP 的 Javac 编译出错
PWC6199:生成的 servlet 错误: 源值 1.5 已过时,将在未来版本中删除
PWC6199:生成的 servlet 错误: 目标值 1.5 已过时,将在未来版本中删除
PWC6199:生成的 servlet 错误: 要禁止显示有关过时选项的警告,请使用 -Xlint:-options。
PWC6197:jsp 文件/index.jsp 中的第 22 行发生错误 PWC6199:生成的 servlet 错误: 非法字符:'\u200c'
PWC6197:jsp 文件/index.jsp 中的第 22 行发生错误 PWC6199:生成的 servlet 错误: 不是声明
PWC6197:jsp 文件/index.jsp 中的第 22 行发生错误 PWC6199:生成的 servlet 错误: 非法字符:'\u200c'
PWC6197:jsp 文件/index.jsp 中的第 22 行发生错误 PWC6199:生成的 servlet 错误: 非法字符:'\u200c'
PWC6197:jsp 文件/index.jsp 中的第 22 行发生错误 PWC6199:生成的 servlet 错误: 不是声明
我的代码:
<%@ page import="java.sql.*" %>
<%@page import="org.apache.derby.jdbc.*" %>
<%Class.forName("org.apache.derby.jdbc.ClientDriver"); %>
<%@ page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Shop</title>
</head>
<body>
<h1>Shopdatenbank</h1>
<h2>Kunden</h2>
<%!public class Customer{
String URL ="jdbc:derby://localhost:1527/shop";
String USERNAME="";
String PASSWORD="";
Connection connection =null;
PreparedStatement selectKunde = null;
ResultSet resultSet = null;
public Customer(){
try{
connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
selectKunde = connection.prepareStatement(
"SELECT* FROM customer");
}
catch (SQLException e){
e.printStackTrace();
}
}
public ResultSet getCustomer(){
try{
resultSet = selectCustomer.executeQuery();
} catch (SQLException e){
e-printStackTrace();
}
return resultSet;
}
}
%>
<%
Customer customer = new Customer();
resultSet customer = customer.getKunde();
%>
<table border="1">
<thead>
<tr>
<th> Name </th>
<th> Street </th>
<th> Code </th>
<th> City </th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</body>
<script>
function delete(){
document.eingabeFeld.feldName.value ="";
}
</script>
</html>
【问题讨论】:
标签: java jsp servlets netbeans java-ee-7