《JSP网络开发实例自学手册》书中附带例子出现错误
发表在JavaWeb图书答疑 2011-04-22
是否精华
版块置顶:
我购买了《JSP网络开发实例自学手册》书中的新闻网的那个例子出现错误,
平台是tomcat6.0+jdk1.6+sql2000sp4在运行的时候总是
org.apache.jasper.JasperException: Unable to compile class for JSP: 
An error occurred at line: 7 in the generated java file
Only a type can be imported. com.actionForm.NewsForm resolves to a package


An error occurred at line: 15 in the jsp file: /wyNews/index.jsp
ObjectDao cannot be resolved to a type
12: <title>宇晨新闻网--首页</title>
13: </head>
14: <%
15: ObjectDao objectDao=new ObjectDao();
16: String typeNews=null;
17: String hql="";
18: java.util.List list=null;


还有一些其他错误,希望斑竹看看,,帮帮忙,小弟在这谢谢了。
我上传到115里面2个压缩包,一个是书上原样的例子,还有一个就是我添加了LIB的例子,
斑竹帮忙调试下,谢谢。
http://u.115.com/file/t65605aeae        带LIB
http://u.115.com/file/t629fd502a        不带LIB
分享到:
精彩评论 2
fbiliulei
学分:0 LV1
TA的每日心情
奋斗
2021-11-12 09:03:45
2011-04-22
沙发
HTTP Status 500 - 

--------------------------------------------------------------------------------

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 7 in the generated java file
Only a type can be imported. com.actionForm.NewsForm resolves to a package

An error occurred at line: 8 in the generated java file
Only a type can be imported. com.dao.ObjectDao resolves to a package

An error occurred at line: 9 in the generated java file
Only a type can be imported. com.tools.TimeShow resolves to a package

An error occurred at line: 10 in the generated java file
Only a type can be imported. com.actionForm.SortForm resolves to a package

An error occurred at line: 15 in the jsp file: /wyNews/index.jsp
ObjectDao cannot be resolved to a type
12: <title>宇晨新闻网--首页</title>
13: </head>
14: <%
15: ObjectDao objectDao=new ObjectDao();
16: String typeNews=null;
17: String hql="";
18: java.util.List list=null;


An error occurred at line: 15 in the jsp file: /wyNews/index.jsp
ObjectDao cannot be resolved to a type
12: <title>宇晨新闻网--首页</title>
13: </head>
14: <%
15: ObjectDao objectDao=new ObjectDao();
16: String typeNews=null;
17: String hql="";
18: java.util.List list=null;


An error occurred at line: 19 in the jsp file: /wyNews/index.jsp
NewsForm cannot be resolved to a type
16: String typeNews=null;
17: String hql="";
18: java.util.List list=null;
19: NewsForm newsForm=null;
20: int overnumber=4;
21: %>
22: <body onLoad="clockon(bgclock);">




An error occurred at line: 333 in the jsp file: /wyNews/index.jsp
SortForm cannot be resolved to a type
330:               newsForm=(NewsForm)list.get(i);
331:               String fileroad="newsContent/"+newsForm.getShowNews();
332:               hql="from SortForm where id='"+newsForm.getSortId()+"'";
333:               SortForm sortForm=(SortForm)objectDao.queryFrom(hql);
334:               %>
335:             <tr>
336:               <td width="230" height="28">


An error occurred at line: 339 in the jsp file: /wyNews/index.jsp
TimeShow cannot be resolved
336:               <td width="230" height="28">
337:               <a href="#" onclick="javasrcipt:window.open('<%=fileroad%>','','fullscreen=0,scrollbars=0');"><%=newsForm.getTitle()%></a>
338:              &#8212; <%=sortForm.getSmallSort() %>
339:                <%if(newsForm.getCreateTime().equals(TimeShow.cuttentMonthDate())){%>
340:               <img src="images/new.gif"><%}%>
341:               <hr></td>
342:             </tr> 


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.

中间错误太多,我删掉一些
aster
学分:0 LV1
TA的每日心情
开心
2023-01-31 09:41:43
2011-04-25
板凳
读者您好:
请看一下ObjectDao类的导入是否存在问题。
首页上一页 1 下一页尾页 2 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照