首页上一页 1 下一页尾页 1 条记录 1/1页
JSP文件调用出错
发表在JavaWeb图书答疑
2009-03-20
是否精华
是
否
版块置顶:
是
否
老师:
您好!
我将《JSP项目开发全程实录》书中第六章变更项目导入MyEclipse中,default.jsp文件调用top.jsp时报错,请问是何原因?望赐教!谢谢!
附注:带x的红圈错误提示为
Description Resource Path Location Type
UserForm cannot be resolved to a type default.jsp test/WebRoot/WEB-INF line 13 JSP Problem
UserForm cannot be resolved to a type default.jsp test/WebRoot/WEB-INF line 13 JSP Problem
UserForm cannot be resolved to a type default.jsp test/WebRoot/WEB-INF line 13 JSP Problem
default.jsp文件
<%@ page language="java" pageEncoding="gb2312"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>网页主窗口</title>
<link rel="stylesheet" type="text/css" href="CSS/style.css">
</head>
<%@ include file="top.jsp"%>
<body>
<table width="1003" border="0" cellpadding="0" cellspacing="0" height="590">
<tr>
<td width="202" valign="bottom">
<iframe src="left.jsp" width="100%" height="100%" frameborder="0" scrolling="auto" name="leftiframe">
</iframe>
</td>
<td width="801" valign="top">
<iframe src="main.jsp" width="100%" height="100%" frameborder="0" scrolling="auto" name="mainFrame">
</iframe>
</td>
</tr>
<tr>
<td height="17" valign="bottom" background="Images/left_bg_bottom.jpg"></td>
<td height="17" valign="bottom" background="Images/main_bottom.jpg"></td>
</tr>
</table>
</body>
</html:html>
top.jsp文件代码(其无问题):
<%@ page language="java" pageEncoding="gb2312"%>
<jsp:directive.page import="com.struts.form.UserForm;"/>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>网页主窗口</title>
<link rel="stylesheet" type="text/css" href="CSS/style.css">
<script src="JS/DateTime2.js"></script>
<script language="javascript">
function Check()
{
if(confirm("确定要重新登录本系统吗??"))
{
window.location="index.jsp";
}
}
</script>
<script language="javascript">
function Check1()
{
window.close();
}
</script>
<%
if((UserForm) session.getAttribute("uform") == null){ //如果session过期,则提示用户重新登录系统
%>
<script language="javascript">
alert("您登录的网页已经过期,请重新登录!");
window.location="index.jsp"
</script>
<%}else{ //如果session没有过期,将执行以下代码
UserForm uf =(UserForm) session.getAttribute("uform");
application.setAttribute("Purview",uf.getUserPurview());
application.setAttribute("un",uf.getUserName());
%>
</head>
<body>
<table width="1003" height="114" border="0" align="center" cellpadding="0" cellspacing="0" background="Images/top_bg.jpg">
<tr>
<td height="67"> </td>
</tr>
<tr>
<td valign="top"><table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="17" colspan="3"> </td>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30%" align="center"><a href="default.jsp" style="color:#546A3E"> 首页</a></td>
<td width="44%" align="left"> <a href="#" onClick="Check();return false;" style="color:#546A3E">重新登录</a></td>
<td width="26%"> <a href="#" onClick="Check1();return false;" style="color:#546A3E">退出</a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="21%"> </td>
<td width="55%" class="word_white"> 用户名: <%=uf.getUserName()%> 权限:<%=uf.getUserPurview()%> 所在部门:<%=uf.getUserbranch()%></td>
<td colspan="2" class="word_white" id="Time"> <script language="javascript">ShowDate(Time);</script></td>
<td width="10%" class="word_white" id="Time2"> <script language="javascript">ShowTime(Time2);</script></td>
</tr>
</table></td>
</tr>
</table>
<%} %>
</body>
</html>
您好!
我将《JSP项目开发全程实录》书中第六章变更项目导入MyEclipse中,default.jsp文件调用top.jsp时报错,请问是何原因?望赐教!谢谢!
附注:带x的红圈错误提示为
Description Resource Path Location Type
UserForm cannot be resolved to a type default.jsp test/WebRoot/WEB-INF line 13 JSP Problem
UserForm cannot be resolved to a type default.jsp test/WebRoot/WEB-INF line 13 JSP Problem
UserForm cannot be resolved to a type default.jsp test/WebRoot/WEB-INF line 13 JSP Problem
default.jsp文件
<%@ page language="java" pageEncoding="gb2312"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>网页主窗口</title>
<link rel="stylesheet" type="text/css" href="CSS/style.css">
</head>
<%@ include file="top.jsp"%>
<body>
<table width="1003" border="0" cellpadding="0" cellspacing="0" height="590">
<tr>
<td width="202" valign="bottom">
<iframe src="left.jsp" width="100%" height="100%" frameborder="0" scrolling="auto" name="leftiframe">
</iframe>
</td>
<td width="801" valign="top">
<iframe src="main.jsp" width="100%" height="100%" frameborder="0" scrolling="auto" name="mainFrame">
</iframe>
</td>
</tr>
<tr>
<td height="17" valign="bottom" background="Images/left_bg_bottom.jpg"></td>
<td height="17" valign="bottom" background="Images/main_bottom.jpg"></td>
</tr>
</table>
</body>
</html:html>
top.jsp文件代码(其无问题):
<%@ page language="java" pageEncoding="gb2312"%>
<jsp:directive.page import="com.struts.form.UserForm;"/>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<head>
<title>网页主窗口</title>
<link rel="stylesheet" type="text/css" href="CSS/style.css">
<script src="JS/DateTime2.js"></script>
<script language="javascript">
function Check()
{
if(confirm("确定要重新登录本系统吗??"))
{
window.location="index.jsp";
}
}
</script>
<script language="javascript">
function Check1()
{
window.close();
}
</script>
<%
if((UserForm) session.getAttribute("uform") == null){ //如果session过期,则提示用户重新登录系统
%>
<script language="javascript">
alert("您登录的网页已经过期,请重新登录!");
window.location="index.jsp"
</script>
<%}else{ //如果session没有过期,将执行以下代码
UserForm uf =(UserForm) session.getAttribute("uform");
application.setAttribute("Purview",uf.getUserPurview());
application.setAttribute("un",uf.getUserName());
%>
</head>
<body>
<table width="1003" height="114" border="0" align="center" cellpadding="0" cellspacing="0" background="Images/top_bg.jpg">
<tr>
<td height="67"> </td>
</tr>
<tr>
<td valign="top"><table width="100%" height="45" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="17" colspan="3"> </td>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30%" align="center"><a href="default.jsp" style="color:#546A3E"> 首页</a></td>
<td width="44%" align="left"> <a href="#" onClick="Check();return false;" style="color:#546A3E">重新登录</a></td>
<td width="26%"> <a href="#" onClick="Check1();return false;" style="color:#546A3E">退出</a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="21%"> </td>
<td width="55%" class="word_white"> 用户名: <%=uf.getUserName()%> 权限:<%=uf.getUserPurview()%> 所在部门:<%=uf.getUserbranch()%></td>
<td colspan="2" class="word_white" id="Time"> <script language="javascript">ShowDate(Time);</script></td>
<td width="10%" class="word_white" id="Time2"> <script language="javascript">ShowTime(Time2);</script></td>
</tr>
</table></td>
</tr>
</table>
<%} %>
</body>
</html>