主题:[讨论]关于页面转换的错误
有两个jsp页面:
[b]1 AddNewsStep2.jsp,<%[/b]@ include file="incoming/ConnectDB.jsp"%>
<%@ include file="incoming/Common.jsp"%>
<%@ include file="Check.jsp"%>
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="incoming/Header.jsp"%>
<html>
<head>
<link href="incoming/style.css" rel="stylesheet" type="text/css">
<script Language="Javascript">
<!--
function check_input(theForm)
{
//判断是否输入新闻标题
if (theForm.newstitle.value=="")
{
alert("请输入新闻标题.");
theForm.newstitle.focus();
return(false);
}
//判断是否输入新闻内容
if(theForm.newsbody.value=="")
{
alert("请输入新闻内容.");
theForm.newsbody.focus();
return(false);
}
//判断新闻标题是否符合要求
if(theForm,newstitle.value.length>50)
{
alert("新闻标题长度应小于25个字.");
theForm.newstitle.focus();
return(false);
}
}
-->
</script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:649px;
top:42px;
width:187px;
height:28px;
z-index:1;
visibility: hidden;
}
-->
</style>
</head>
<body>
<% int m=0;
int i=1;
sql1="select * from news";
rs1=smt1.executeQuery(sql1);
while(rs1.next())
{
m=++i;
}
%>
<%
String categoryid= request.getParameter("categoryid");
%>
<table width=700 border="1" align=center cellpadding=0 cellspacing=0 bgcolor="#FFCC66">
<form name="theForm"method="post" action="AddNewsStep2.jsp?categoryid=<%=categoryid%>" onSubmit="return check_input(this)">
<tr align="center" bgcolor="#CCCCCC" height=25>
<td height="42" colspan=2 bgcolor="#FFCC66"><a class="title">发布新闻(*为必填项目)</a><div id="Layer1">
<label></label>
<font color=#000000>
<input name="categoryid" type="text" value="<%=categoryid%>">
</font></div></TD>
</tr>
<tr>
<td width="399" height="31" align="center" class="text">新闻标题:
<input name="newstitle" type="text" id="newstitle" size=30 maxlength=25>
*不超过25个汉字</td>
<td width="295" align="center" class="text"><div align="left">作者:
<input name="authorname" type="text" id="authorname" size=10 maxlength=25>
*
篇码
<input name="newsid" type="text" readonly="true"id="authorname2" value="<%=m%>" size=10 maxlength=25>
</div></td>
</tr>
<tr>
<td height="29" colspan="2" align="center" bgcolor="#FFCC66" >
<B>新闻内容</B><span class="text">*</span></td>
</tr>
<tr>
<td height="80" colspan=2 align=center><FONT color=#000000>
<textarea name="newsbody" cols="95%" rows="30" wrap="VIRTUAL"
class="smallarea" id="newsbody" title="请在此填写新闻内容."></textarea>
</font></td>
</tr>
<tr>
<td height="54" colspan=2 align=center><font color=#000000>
<input name=submit type=submit value="发布">
<input name=submit2 type=reset value="取消">
</font></td>
</tr>
</form>
</table>
<center><%@ include file="incoming/Footer.jsp"%></center>
</body>
</html>
[b]和2,AddNewsStep2.jsp[/b],
<%@ include file="incoming/ConnectDB.jsp"%>
<%@ include file="incoming/Common.jsp"%>
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="incoming/Header.jsp"%>
<html>
<head>
<link href="incoming/style.css" rel="stylesheet" type="text/css">
<script Language="JavaScript">
<!--
function ToNewsMain()
{
top.location="NewsMain.jsp?categoryid="+<%=categoryid%>;
}
-->
</script>
</head>
<body>
<%
String msg="";
try
{ String newsid=request.getParameter("newsid");
//取得栏目ID号,新闻标题,新闻内容
String categoryid=request.getParameter("categoryid");
String newstitle=request.getParameter("newstitle");
String newsbody=request.getParameter("newsbody");
String authorname=request.getParameter("authorname");
//取得系统当前的日期时间
java.util.Date cur_time=new java.util.Date();
SimpleDateFormat formatter=new SimpleDateFormat("YYYY-MM-ddHH:mm:ss");
String adddate=formatter.format(cur_time);
//获取管理者的用户名
String managerid=(String)session.getValue("UserName");
//向表news中添加记录
sql1="insert into news (NewsID,Title,Body,AddDate,ManagerID,CategoryID,Authorname)values('"+newsid+"','"+newstitle+"','"+newsboby+"','"+adddate+"','"+managerid+"','"+categoryid+"','"+authorname+"')";
smt1.executeUpdate(sql1);
//修改表manager中该管理员记录,将TotalNews加1
sql2="UPDATE manager SET TotalNews=TotalNews+1 WHERE ManagerID='"+managerid+"'";
smt2.executeUpdate(sql2);
}
catch(Exception e)
{
msg=e.getMessage();
}
%>
<table width="700" height="600" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#F0F0F0">
<tr>
<td valign="top"><table border="1" width=700 align=center cellpadding=0 cellspacing=0>
<tr align="center" bgcolor="#CCCCCC" height=25>
<td height="42" bgcolor="#FFCC66"><a class="title">发布新闻</a></TD>
</tr>
<tr>
<td height="56" align="center" bgcolor="#FFCC66"><span class="text">
<%
if(msg.equals(""))
out.println("发布新闻成功!");
else
out.println("发布新闻失败!错误原因:"+msg);
%>
</span></td>
</tr>
<tr>
<td height="36" align=center bgcolor="#FFCC66"><FONT color=#000000>
<input name=submit type=submit value="返回新闻管理" onClick="ToNewsMain()">
</font></td>
</tr>
</table></td>
</tr>
</table>
<center><%@ include file="incoming/Footer.jsp"%></center>
</body>
</html>
按下返回新闻管理的按钮时出现错误如下:
500 Servlet Exception
javax.servlet.ServletException: `' is an unknown error page. The JSP errorPage
directive must refer to a valid URL relative to the current web-app.
at com.caucho.jsp.PageContextImpl.handlePageException(PageContextImpl.java:937)
at _jsp._main__jsp._jspService(_main__jsp.java:94)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.pageservice(Page.java:571)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:155)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:331)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:464)
at com.caucho.util.ThreadPool.run(ThreadPool.java:408)
at java.lang.Thread.run(Thread.java:595)
--------------------------------------------------------------------------------
Resin-3.0.8 (built Tue, 08 Jun 2004 02:25:40 PDT)
请问有什么错误,以及上述的错误是什么错误。。
[b]1 AddNewsStep2.jsp,<%[/b]@ include file="incoming/ConnectDB.jsp"%>
<%@ include file="incoming/Common.jsp"%>
<%@ include file="Check.jsp"%>
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="incoming/Header.jsp"%>
<html>
<head>
<link href="incoming/style.css" rel="stylesheet" type="text/css">
<script Language="Javascript">
<!--
function check_input(theForm)
{
//判断是否输入新闻标题
if (theForm.newstitle.value=="")
{
alert("请输入新闻标题.");
theForm.newstitle.focus();
return(false);
}
//判断是否输入新闻内容
if(theForm.newsbody.value=="")
{
alert("请输入新闻内容.");
theForm.newsbody.focus();
return(false);
}
//判断新闻标题是否符合要求
if(theForm,newstitle.value.length>50)
{
alert("新闻标题长度应小于25个字.");
theForm.newstitle.focus();
return(false);
}
}
-->
</script>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
left:649px;
top:42px;
width:187px;
height:28px;
z-index:1;
visibility: hidden;
}
-->
</style>
</head>
<body>
<% int m=0;
int i=1;
sql1="select * from news";
rs1=smt1.executeQuery(sql1);
while(rs1.next())
{
m=++i;
}
%>
<%
String categoryid= request.getParameter("categoryid");
%>
<table width=700 border="1" align=center cellpadding=0 cellspacing=0 bgcolor="#FFCC66">
<form name="theForm"method="post" action="AddNewsStep2.jsp?categoryid=<%=categoryid%>" onSubmit="return check_input(this)">
<tr align="center" bgcolor="#CCCCCC" height=25>
<td height="42" colspan=2 bgcolor="#FFCC66"><a class="title">发布新闻(*为必填项目)</a><div id="Layer1">
<label></label>
<font color=#000000>
<input name="categoryid" type="text" value="<%=categoryid%>">
</font></div></TD>
</tr>
<tr>
<td width="399" height="31" align="center" class="text">新闻标题:
<input name="newstitle" type="text" id="newstitle" size=30 maxlength=25>
*不超过25个汉字</td>
<td width="295" align="center" class="text"><div align="left">作者:
<input name="authorname" type="text" id="authorname" size=10 maxlength=25>
*
篇码
<input name="newsid" type="text" readonly="true"id="authorname2" value="<%=m%>" size=10 maxlength=25>
</div></td>
</tr>
<tr>
<td height="29" colspan="2" align="center" bgcolor="#FFCC66" >
<B>新闻内容</B><span class="text">*</span></td>
</tr>
<tr>
<td height="80" colspan=2 align=center><FONT color=#000000>
<textarea name="newsbody" cols="95%" rows="30" wrap="VIRTUAL"
class="smallarea" id="newsbody" title="请在此填写新闻内容."></textarea>
</font></td>
</tr>
<tr>
<td height="54" colspan=2 align=center><font color=#000000>
<input name=submit type=submit value="发布">
<input name=submit2 type=reset value="取消">
</font></td>
</tr>
</form>
</table>
<center><%@ include file="incoming/Footer.jsp"%></center>
</body>
</html>
[b]和2,AddNewsStep2.jsp[/b],
<%@ include file="incoming/ConnectDB.jsp"%>
<%@ include file="incoming/Common.jsp"%>
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="incoming/Header.jsp"%>
<html>
<head>
<link href="incoming/style.css" rel="stylesheet" type="text/css">
<script Language="JavaScript">
<!--
function ToNewsMain()
{
top.location="NewsMain.jsp?categoryid="+<%=categoryid%>;
}
-->
</script>
</head>
<body>
<%
String msg="";
try
{ String newsid=request.getParameter("newsid");
//取得栏目ID号,新闻标题,新闻内容
String categoryid=request.getParameter("categoryid");
String newstitle=request.getParameter("newstitle");
String newsbody=request.getParameter("newsbody");
String authorname=request.getParameter("authorname");
//取得系统当前的日期时间
java.util.Date cur_time=new java.util.Date();
SimpleDateFormat formatter=new SimpleDateFormat("YYYY-MM-ddHH:mm:ss");
String adddate=formatter.format(cur_time);
//获取管理者的用户名
String managerid=(String)session.getValue("UserName");
//向表news中添加记录
sql1="insert into news (NewsID,Title,Body,AddDate,ManagerID,CategoryID,Authorname)values('"+newsid+"','"+newstitle+"','"+newsboby+"','"+adddate+"','"+managerid+"','"+categoryid+"','"+authorname+"')";
smt1.executeUpdate(sql1);
//修改表manager中该管理员记录,将TotalNews加1
sql2="UPDATE manager SET TotalNews=TotalNews+1 WHERE ManagerID='"+managerid+"'";
smt2.executeUpdate(sql2);
}
catch(Exception e)
{
msg=e.getMessage();
}
%>
<table width="700" height="600" border="1" align="center" cellpadding="0" cellspacing="0" bgcolor="#F0F0F0">
<tr>
<td valign="top"><table border="1" width=700 align=center cellpadding=0 cellspacing=0>
<tr align="center" bgcolor="#CCCCCC" height=25>
<td height="42" bgcolor="#FFCC66"><a class="title">发布新闻</a></TD>
</tr>
<tr>
<td height="56" align="center" bgcolor="#FFCC66"><span class="text">
<%
if(msg.equals(""))
out.println("发布新闻成功!");
else
out.println("发布新闻失败!错误原因:"+msg);
%>
</span></td>
</tr>
<tr>
<td height="36" align=center bgcolor="#FFCC66"><FONT color=#000000>
<input name=submit type=submit value="返回新闻管理" onClick="ToNewsMain()">
</font></td>
</tr>
</table></td>
</tr>
</table>
<center><%@ include file="incoming/Footer.jsp"%></center>
</body>
</html>
按下返回新闻管理的按钮时出现错误如下:
500 Servlet Exception
javax.servlet.ServletException: `' is an unknown error page. The JSP errorPage
directive must refer to a valid URL relative to the current web-app.
at com.caucho.jsp.PageContextImpl.handlePageException(PageContextImpl.java:937)
at _jsp._main__jsp._jspService(_main__jsp.java:94)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.pageservice(Page.java:571)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:155)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:331)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:464)
at com.caucho.util.ThreadPool.run(ThreadPool.java:408)
at java.lang.Thread.run(Thread.java:595)
--------------------------------------------------------------------------------
Resin-3.0.8 (built Tue, 08 Jun 2004 02:25:40 PDT)
请问有什么错误,以及上述的错误是什么错误。。