MyEclipse 为什么报错

hjqshui 2010-07-25 06:51:00
我的程序 先前设置目录<base href="${basePath }" />
inc/foot.jsp也确实存在。

但使用<jsp:include page="/inc/foot.jsp" flush="false"></jsp:include>这句时报错:
org.apache.jasper.JasperException: javax.servlet.ServletException: File & quot/inc/foot.jsp & quot not found
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

路径设置绝对没问题。判断是和jsp:include path有关,是我的MyEclipse没有设置好吗?高手帮忙啊。。急死了。。

${basePath}的值为http://localhost:8080/javakeshe/ 完全没错

为什么报错显示path的值有加“”即 & quot (我特地在中间加了空格)
...全文
396 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
luo476979657 2011-01-25
  • 打赏
  • 举报
回复
Myclipse里边有个jar和服务器有冲突
jdjwxj 2010-07-26
  • 打赏
  • 举报
回复
应该是路径的问题。。。你可以把你这个文件夹结构发出来看下。
darrenluo 2010-07-26
  • 打赏
  • 举报
回复
为什么不这么写呢
<%@ include file="/inc/foot.jsp"%>
kingshigang 2010-07-26
  • 打赏
  • 举报
回复
路径不正确
hjqshui 2010-07-26
  • 打赏
  • 举报
回复
4楼的方式试了。。不行。。不是句子问题。。可能是配置问题。。有人碰到类似的情况么?
hjqshui 2010-07-26
  • 打赏
  • 举报
回复
补充:${basePath}我是在过滤器中进行填充的,代码为:
request.setAttribute(BASEPATH,request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+((HttpServletRequest)request).getContextPath()+"/");

将flush改为"true"后,显示${basePath}的值也是正确的。。
hjqshui 2010-07-26
  • 打赏
  • 举报
回复
照14楼改过以后还是不成功,贴的是照14楼方法改过的程序
hjqshui 2010-07-26
  • 打赏
  • 举报
回复
全部的代码:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<base href="${basePath}">
<title>用户登录页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<link href="resource/css/style.css" rel="stylesheet" type="text/css" />
</head>

<script type="text/javascript">
function checkLogin(){
var name = document.getElementById('username').value;
var psw = document.getElementById('psw').value;
if(name == 0){
alert("用户名不能为空!");
document.getElementById('username').focus();
return false;
}
if ((name.length != 0)) {
var i;
for (i = 0; i < name.length; i++) {
if (name.charAt(i) == " ") {
alert("用户名不能有空格!");
document.getElementById('username').focus();
return false;
}
}
}
if(name.length > 20){
alert("用户名输入字符过长,需在20个字以内!");
document.getElementById('username').focus();
return false;
}


if(psw == 0){
alert(" 密码输入不能为空!");
document.getElementById('psw').focus();
return false;
}
if(psw.length > 20){
alert("密码过长,控制在20个字符内!");
document.getElementById('psw').focus();
return false;
}
}

</script>

<body style="margin-top: 3px;">
${alert }
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="resource/imagine/banner900.gif" width="900" height="70" /></td>
</tr>
<form action="/sztz/module/admin/login.do" method="post">
<table width="900" border="1" bordercolor="#AAABBA" align="center"
cellpadding="0" cellspacing="0" style="margin-top: 5px;">
<tr>
<td class="top" align="center" >
用户登录
<br></td>
</tr>
<tr>
<td align="center" valign="top" class="bottom">
<table width="300" border="0" cellspacing="0" cellpadding="0"
style="font-size: 12px">
<tr>

<td width="100" height="25" align="right" valign="middle">
用户名:
</td>
<td width="200" height="25" align="left" valign="middle">
<input type="text" name="username" value="${username}"
id="username" style="width: 200px;"/>
</td>
</tr>
<tr>
<td width="100" height="25" align="right" valign="middle">
密码:
</td>
<td width="200" height="25" align="left" valign="middle">
<input type="password" name="psw" id="psw" value="${psw }"
style="width: 200px;"/>
</td>
</tr>

<tr>
<td width="100" height="25" align="right" valign="middle">
登录类型:
</td>
<td width="200" height="25" align="left" valign="middle">
<select id="glyjs" name="glyjs" style="width: 200px;" value="${leixing }">
<option value="0" />
系统管理员
<option value="1" />
公司成员
</select>
</td>
</tr>

<tr>
<td height="25" colspan="2" align="center" valign="middle">
<input type="submit" onclick="return checkLogin();" name="ok"
id="button" value="提 交"
style="border: none; background: none; width: 70px; height: 20px; background: url(resource/imagine/button.gif) center no-repeat; cursor: pointer;" />
   
<input type="reset" name="button2" id="button2" value="重 置"
style="border: none; background: none; width: 70px; height: 20px; background: url(resource/imagine/button.gif) center no-repeat; cursor: pointer;" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<jsp:include page="<%=request.getContextPath() %>/inc/foot.jsp" flush="true"/>



</table>
</body>
</html>
printf_2012 2010-07-26
  • 打赏
  • 举报
回复
改成:<jsp:include page="<%=request.getContextPath() %>/inc/foot.jsp" flush="true"/>试试
chooseforget 2010-07-26
  • 打赏
  • 举报
回复
<jsp:include page="/inc/foot.jsp" flush="false"></jsp:include>改为
改为
<jsp:include page="inc/foot.jsp" flush="false"></jsp:include>试试。
你把你的代码结构图发出来看看呀。
q1145 2010-07-26
  • 打赏
  • 举报
回复
你把所有的代码都贴出来,写代码最忌讳断章取义。
songzhiwei1984 2010-07-26
  • 打赏
  • 举报
回复
很明显,quot/inc/foot.jsp & quot not found
就是这个路径找不到,你为什么要写死啊?你应该用相对路径吧?貌似直接写死有问题
hjqshui 2010-07-26
  • 打赏
  • 举报
回复
回8楼:路径肯定是没错的.不知道哪里发图片。所以没办法发结构出来。inc文件夹在WEB-INF下,foot.jsp就在INC文件夹下.
hjqshui 2010-07-26
  • 打赏
  • 举报
回复
回7楼:我以后要引用的是动态的页面。但现在用静态的改为你那中写法后,报HTTP Status 500 -错
org.apache.jasper.JasperException: /index.jsp(122,3) File "/inc/foot.jsp" not found

或者报org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP


qq14017152 2010-07-25
  • 打赏
  • 举报
回复
<jsp:include page="/inc/foot.jsp" flush="false"></jsp:include>改为
<jsp:include page="/inc/foot.jsp" flush="false"/>
TSHP624824 2010-07-25
  • 打赏
  • 举报
回复
找不到问题所在
hjqshui 2010-07-25
  • 打赏
  • 举报
回复
各种地方都看了。。没找到问题所在,找不到问题,就无法在JSP中加如动态页面啦。。。很悲剧啊
董小尾 2010-07-25
  • 打赏
  • 举报
回复
这个问题倒是没有遇到过!!

慢慢来不要急,肯定有地方出现问题了。仔细排查一下吧。

友情UP~~~

81,095

社区成员

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

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