Java-jsp代码出现Internal Servlet Error错误,如何解决?

Java-jsp代码出现Internal Servlet Error错误,如何解决?

夜无邪 发布于 2017-02-18 字数 2710 浏览 1110 回复 1

请问我这段代码错在那里,谢谢!我写了一段显示数据库内容的代码,服务器为tomcat3.3,jsp的保存路径是C:jakarta-tomcat-3.3webappsrootaaa
运行时总是显示

Error: 500 Location:
/AAA/person_inf.jsp Internal Servlet
Error:

org.apache.jasper.JasperException:
Unable to compile
C:jakarta-tomcat-3.3workDEFAULTROOTAAAperson_inf_1.java:61:
???? person.personbean?
person.personbean p_bean = null; ^
C:jakarta-tomcat-3.3workDEFAULTROOTAAAperson_inf_1.java:64:
???? person.personbean? p_bean=
(person.personbean) ^
C:jakarta-tomcat-3.3workDEFAULTROOTAAAperson_inf_1.java:69:
???? person.personbean? p_bean =
(person.personbean)
java.beans.Beans.instantiate(this.getClass().getClassLoader(),
"person.personbean"); ^ 3 ???

at
org.apache.tomcat.facade.JasperLiaison.javac(Unknown
Source) at
org.apache.tomcat.facade.JasperLiaison.processJspFile(Unknown
Source) at
org.apache.tomcat.facade.JspInterceptor.requestMap(Unknown
Source) at
org.apache.tomcat.core.ContextManager.processRequest(Unknown
Source) at
org.apache.tomcat.core.ContextManager.internalService(Unknown
Source) at
org.apache.tomcat.core.ContextManager.service(Unknown
Source) at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown
Source) at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown
Source) at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
Source) at
java.lang.Thread.run(Thread.java:484)

请问是怎么回事?

这是person_inf.jsp

<html> 
<head>
<meta http-equiv = "Content-Type" content="text/html;charset=gb2312">
<title>AAAAAA</title>
</head>
<body>

<p>AAAAAAA</p>

<table border="1" width="100%">

<%@ page language="Java" import="java.sql.*" %>
<jsp:useBean id="p_bean" scope="page" class="person.personbean" ></jsp:useBean>

<%

ResultSet RS = p_bean.executeQuery("select supplierID,companyname from suppliers");

while (RS.next())
{

out.print("<tr>");

out.print("<td width="50%">");
out.print(RS.getString("supplierID"));
out.print("</td>");

out.print("<td width="50%">");
out.print(RS.getString("companyname"));
out.print("</td>");

out.print("</tr>");

}

%>

</table>
</body>
</html>

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚风撩人 2017-07-29 1 楼

应该是编码的问题,你的jsp只指定了客户端编码,没有指定服务端编码,可能造成客户端与服务端不一致,就出现很多个????.
这样写:<meta http-equiv = "Content-Type" content="text/html;charset=gb2312"> 只是指定了客户端的编码格式,<%@ page language="Java" import="java.sql.*" %> 并没有指定服务端的编码格式。
试试这样写:<%@ page language= "java " contentType= "text/html; charset=gb2312 "%>。这一行最好写写在<html>外面