tomcat编辑JSP错误释疑

bzg119 2002-08-23 10:00:08
某JSP页在JBUILDER自带的TOMCAT环境下运行正常,但当添加到外部TOMCAT时,出现如下错误:
org.apache.jasper.JasperException: Unable to compile class for JSP
D:\Program Files\Apache Tomcat 4.0\work\localhost\zhengxian\zlsq\list$jsp.java:197: Incompatible type for method. Explicit cast needed to convert java.lang.Throwable to java.lang.Exception.
if (pageContext != null) pageContext.handlePageException(t);
^
1 error
..............................................
显然pageContext是它自己编绎出来的代码,TOMCAT设置及项目设置均正常,是什么愿因呢?
请各位指点!
...全文
25 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
bzg119 2002-08-23
  • 打赏
  • 举报
回复
<%@ page contentType="text/html; charset=GB2312" %>
<%@ page import="zhengxian.*,zxtools.*,java.util.*"%>
这是页头的设置.
zhengxian.*,zxtools.*,是自己写的类.
ericsome 2002-08-23
  • 打赏
  • 举报
回复
JSP页面的页头有点问题啦
bzg119 2002-08-23
  • 打赏
  • 举报
回复
怎么解决呢?谢谢!
outer2000 2002-08-23
  • 打赏
  • 举报
回复
t是一个异常类吧?转换错误。
bzg119 2002-08-23
  • 打赏
  • 举报
回复
但这是TOMCAT自已编绎JSP页面时生成的,我怎么处理它呢?
yyt99 2002-08-23
  • 打赏
  • 举报
回复
类型不匹配。要将
catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
}
中的t,声明为:Exception. 即:
catch (Exception t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
}
bzg119 2002-08-23
  • 打赏
  • 举报
回复
下面是TOMCAT编绎JSP的结果:
package org.apache.jsp;

import zhengxian.*;
import zxtools.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class list$jsp extends HttpJspBase {
static {
}
public list$jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
....................... 略 .......................................
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
WHY????有谁能帮助我????
bzg119 2002-08-23
  • 打赏
  • 举报
回复
JSP页面如下,什么问题?帮忙看看.在JBUILDER环境下能够跑起来!

<%@ page contentType="text/html; charset=GB2312" isThreadSafe="true"%>
<%@ page import="zhengxian.*,zxtools.*,java.util.*"%>
<html>
<head>
<title>资料索取列表</title>
<link rel="stylesheet" href="/technology/public/css/public.css" type="text/css">
</head>
<body>
<jsp:useBean id="zxdatum" scope="session" class="zhengxian.ZXdatum"/>
<%
Collectioner collectioner = zxdatum.getList();
%>
<%
// PageContext pageContext = null;///////////////////

int pageNum = 1;
if(request.getParameter("page") != null){
String pageStr = request.getParameter("page");
if(pageStr == null || pageStr.equals("") )
pageNum = 1;
else
pageNum = Integer.parseInt(pageStr);
}
collectioner.setCurrentPage(pageNum);
%>
<%
ArrayList al = null;
al = collectioner.getThisPage();
%>
<table width="660" align="center">
<tr align="center" bgcolor="#ffcc33">
<td colspan="3" valign="top" width="660">资料索取</td>
</tr>
<tr align="center">
<td width="60"><%=collectioner.getPageMarker()%></td>
<td width="320" align="center"><%=collectioner.getPageCross()%></td>
<td width="280" align="right"><%=collectioner.getRecordMarker()%> 到<%=collectioner.getPageJumper()%></td>
</tr>
<tr>
<td colspan="3" valign="top" width="660">
<table width="660" align="center" bgcolor="#FEFDD5">
<tr align="center">
<td width="60" valign="top">状态</td>
<td width="200" valign="top">索取要求</td>
<td width="120" valign="top">索取人</td>
<td width="140" valign="top">E-mail</td>
<td width="140" valign="top">联系电话</td>
</tr>
<%
String prStr = "<img src=\"/technology/public/images/UNSURE.gif\" width=\"12\" height=\"10\">";
Iterator iter = al.iterator();
while(iter.hasNext()) {
ZXdatumValue zv = (ZXdatumValue)iter.next();
if(zv.getdisposed() == 1) prStr = "<img src=\"/technology/public/images/AGREE.gif\" width=\"12\" height=\"10\">";
String tneed = " " , tname = " " , email = " " , telephonecode = " ";
if(zv.gettneed() != null) tneed = zv.gettneed();
if(zv.gettname() != null) tname = zv.gettname();
if(zv.getemail() != null) email = zv.getemail();
if(zv.gettelephonecode() != null) telephonecode = zv.gettelephonecode();
if(tneed.equals("")) tneed = " ";
if(tname.equals("")) tname = " ";
if(email.equals("")) email = " ";
if(telephonecode.equals("")) telephonecode = " ";
tneed = tneed.length()>26?tneed.substring(0,26)+"...":tneed;
tname = tname.length()>10?tname.substring(0,10)+"...":tname;
email = email.length()>20?email.substring(0,20)+"...":email;
telephonecode = telephonecode.length()>20?telephonecode.substring(0,20)+"...":telephonecode;
out.println("<tr>");
out.println("<td align=\"center\" width=\"60\" valign=\"top\">" + prStr + "</td>");
out.println("<td width=\"200\" valign=\"top\"><a href=\"javaScript:void openContent(" + zv.getcid() + ");\">" + tneed + "</a></td>");
out.println("<td align=\"center\" width=\"120\" valign=\"top\">" + tname + "</td>");
out.println("<td align=\"center\" width=\"140\" valign=\"top\">" + email + "</td>");
out.println("<td align=\"center\" width=\"140\" valign=\"top\">" + telephonecode + "</td>");
out.println("</tr>");
}
%>
</table>
</td>
</tr>
</table>
</body>
<script language="javaScript">
function forwardPage(num){
var page = num;
page = page + 1;
window.open("list.jsp?page="+page+"","_parent","");
}
function backPage(num){
var page = num;
page = page - 1;
if(page <= 0) page = 1;
window.open("list.jsp?page="+page+"","_parent","");
}
function go(num){
var page = num;
window.open("list.jsp?page="+page+"","_parent","");
}
function openContent(parem){
window.open("content.jsp?cid="+parem,"_blank","height=470, width=420,scrollbars=yes , toolbar=no, menubar=no, resizable=no, location=no, status=no");
}
</script>
</html>

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧