插入jsp代码后显示404错误,在线等 遇到这样一个问题:放入jsp代码后,显示404错误。 这种情况一般是发生在什么状况下?是jsp代码有错误,还是连接数据库取数据时发生错误,还是其他的原因?请指教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 位置没对,或者你访问的路径错了,或者是web.xml错了 页面没找到,看看跳转的路径和jsp页面放的位置是否一致 你可以看一下tomcat运行环境下有没有生成它对应的class文件 是没生成class文件,,是不是jsp代码写错了,不能编译?还是其他的原因 我是myeclipse中写的,没提示语法的错误,是不是还有其他的什么原因 <%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*" errorPage="" %><jsp:directive.page import="com.spring.*"/><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><!-- TemplateBeginEditable name="doctitle" --><title>无标题文档</title><!-- TemplateEndEditable --><!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --></head><body><table width="698" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td height="87" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="698" height="87"> </td> </tr> </table> </td> </tr> <tr> <td width="161" height="2723" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="161" height="2723" valign="top"><div align="center"><strong>新闻分类</strong></div> <br /> <br /> <% FirstTitleOperate fto = new FirstTitleOperate(); Vector v = fto.getData(); if(v.size() !=0) { for(int i = 0 ; i<v.size();i++) { FirstTitleBean ft =(FirstTitleBean) v.get(i); %> <div align="center"><%=ft.getTitlename() %></div> <br /> <br /> <% } } %> </td> </tr> </table> </td> <td width="537" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="537" height="2723" valign="top"><!--DWLayoutEmptyCell--> </td> </tr> </table> </td> </tr></table></body></html>这个是forward.jsp 文件 <% FirstTitleOperate fto = new FirstTitleOperate(); Vector v = fto.getData(); if(v.size() !=0) { for(int i = 0 ; i <v.size();i++) { FirstTitleBean ft =(FirstTitleBean) v.get(i); %> <div align="center"> <%=ft.getTitlename() %> </div> <br /> <br /> <% } } %> 比如说我把以上这段代码删除掉在地址栏中输入http://localhost:8080/new/forward.jsp没问题,出现 “新闻分类” 字样当加上了jsp代码片段后IE就出现了下面的提示: 无法找到该网页 HTTP 404 最可能的原因是:在地址中可能存在键入错误。 当您点击某个链接时,它可能已过期。 您可以尝试以下操作: 重新键入地址。 返回到上一页。 转至 并查找您想要的信息。 更多信息 我晕问题在这里,应该是你这段代码出错,然后它根据 errorPage="" 跑到错误页面,而你又没配错误页面解决方法,去掉这个 errorPage="" 或者配一个错误页面 应该是哦,你先照下面改if(v != null){ if(v.size() !=0) { for(int i = 0 ; i <v.size();i++) { FirstTitleBean ft =(FirstTitleBean) v.get(i); %> <div align="center"> <%=ft.getTitlename() %> </div> <br /> <br /> <% } } } 我知道404是肯定是路径错楼主的主要原因是那段JAVA代码出错(500错),然后配了errorPage=“”,然后就跳到错误页面,但楼主又没指定错误页面的地址,所以才报404错误 求一HQL语句(急!!!) 开发一个小型的站点,不知道需要不需要用到框架?还是必需用到web框架 重新开帖,第一个JSP问题 JAVA技术群! 请问jsp里,怎样使单选按钮只读,谢谢。 急求图片上传案列 阻止JSP页面显示的原因有哪些啊?(在调试的时候) 利用servlet进行跳转到一个jsp页面后,此页面css样式表调用无效??? 有struts高手吗?进来看看 菜鸟问题:怎么用别人开发出来的*.java文件? 一个关于时间的问题 刚学习存储过程,遇到的麻烦。帮帮忙。先谢了
<jsp:directive.page import="com.spring.*"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>无标题文档</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head><body>
<table width="698" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="87" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="698" height="87"> </td>
</tr>
</table> </td>
</tr>
<tr>
<td width="161" height="2723" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="161" height="2723" valign="top"><div align="center"><strong>新闻分类</strong></div>
<br />
<br />
<%
FirstTitleOperate fto = new FirstTitleOperate();
Vector v = fto.getData();
if(v.size() !=0)
{
for(int i = 0 ; i<v.size();i++)
{
FirstTitleBean ft =(FirstTitleBean) v.get(i);
%>
<div align="center"><%=ft.getTitlename() %></div>
<br />
<br />
<%
}
}
%>
</td>
</tr>
</table> </td>
<td width="537" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="537" height="2723" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
这个是forward.jsp 文件
FirstTitleOperate fto = new FirstTitleOperate();
Vector v = fto.getData();
if(v.size() !=0)
{
for(int i = 0 ; i <v.size();i++)
{
FirstTitleBean ft =(FirstTitleBean) v.get(i);
%>
<div align="center"> <%=ft.getTitlename() %> </div>
<br />
<br />
<%
}
}
%>
比如说我把以上这段代码删除掉
在地址栏中输入http://localhost:8080/new/forward.jsp
没问题,出现 “新闻分类” 字样
当加上了jsp代码片段后IE就出现了下面的提示:
无法找到该网页
HTTP 404
最可能的原因是:
在地址中可能存在键入错误。
当您点击某个链接时,它可能已过期。
您可以尝试以下操作:
重新键入地址。
返回到上一页。
转至 并查找您想要的信息。
更多信息
问题在这里,应该是你这段代码出错,然后它根据 errorPage="" 跑到错误页面,而你又没配错误页面
解决方法,去掉这个 errorPage="" 或者配一个错误页面
if(v != null){ if(v.size() !=0)
{
for(int i = 0 ; i <v.size();i++)
{
FirstTitleBean ft =(FirstTitleBean) v.get(i);
%>
<div align="center"> <%=ft.getTitlename() %> </div>
<br />
<br />
<%
}
} }