首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • 为什么出现这个错误:cannot be resolved to a type [无满意答案结贴,结贴人:awt_boy]
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 08:58:13 楼主
    源文件如下:
    Java code
    <%@ page contentType="text/html; charset=utf-8"%> <%@ page import="bug.entity.*"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <html> <head> <script language="JavaScript"> function add() { document.bugActionForm.id = idC.value; document.bugActionForm.sta.value = staC.innerText; document.bugActionForm.url.value = urlC.innerText; document.bugActionForm.pha = phaC.innerText; document.bugActionForm.cat = catC.innerText; document.bugActionForm.ref = refC.innerText; document.bugActionForm.dis = disC.innerText; document.bugActionForm.action = "AddBugAction.do"; document.bugActionForm.submit(); } function search() { document.bugActionForm.id = idC.value; document.bugActionForm.sta.value = staC.innerText; document.bugActionForm.url.value = urlC.innerText; document.bugActionForm.pha = phaC.innerText; document.bugActionForm.cat = catC.innerText; document.bugActionForm.ref = refC.innerText; document.bugActionForm.dis = disC.innerText; document.bugActionForm.action = "AddBugAction.do"; document.bugActionForm.submit(); } function del(id) { document.bugActionForm.id = id; document.bugActionForm.action = "DeleteBugAction.do"; document.bugActionForm.submit(); } </script> </head> <body> <em><bean:message key="message.bugDB"/></em><p> <table> <html:errors/> </table> <bean:message key="message.id"/>:<input name="id" value="" type="text">&nbsp; <bean:message key="message.sta"/>:<input type="sta" name="textfield">&nbsp; <bean:message key="message.url"/> :<input type="url" name="textfield3"> <p> <bean:message key="message.pha"/>:<input type="pha" name="textfield2">&nbsp; <bean:message key="message.cat"/>:<input type="cat" name="textfield4"> </p> <textarea style="height:100" name=refC></textarea> <textarea style="height:100" name=disC></textarea> <html:form action="BugAction.do"> <html:hidden property="id"/> <html:hidden property="sta"/> <html:hidden property="url"/> <html:hidden property="pha"/> <html:hidden property="cat"/> <html:hidden property="ref"/> <html:hidden property="dis"/> <p> <input type="button" onClick="add();" value="<bean:message key="message.add"/>"> <input type="button" onclick="search();" value="<bean:message key="message.search"/>"> </p> </html:form> <table border=1 cellspacing=1 cellpadding=2> <tr> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.id"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.sta"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.url"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.pha"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.cat"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.ref"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.dis"/></td> <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"><bean:message key="message.delete"/></td> </tr> <logic:notEmpty name="allBug"> <logic:iterate name="allBug" id="bug" type="bug.entity.Bug"> <tr> <td style="word-break: break-all;" > <bean:write property="id" name="bug"/> </td> <td style="word-break: break-all;" > <bean:write property="sta" name="bug"/> </td> <td style="word-break: break-all;" > <bean:write property="url" name="bug"/> </td> <td style="word-break: break-all;" > <bean:write property="pha" name="bug"/> </td> <td style="word-break: break-all;" > <bean:write property="cat" name="bug"/> </td> <td style="word-break: break-all;" > <bean:write property="ref" name="bug"/> </td> <td style="word-break: break-all;" > <bean:write property="dis" name="bug"/> </td> <td style="word-break: break-all;" ><input type="button" onclick="del('<%=bug.getId()%>');" value="<bean:message key="message.delete"/>"></td> </tr> </logic:iterate> </logic:notEmpty> </table> </body> </html>
    20  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 09:03:231楼 得分:0
    出错情况如下:

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

    An error occurred at line: 78 in the jsp file: /biye/showBug.jsp
    bug.entity.Bug cannot be resolved to a type
    75:    <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"> <bean:message key="message.delete"/> </td>
    76:    </tr>
    77: <logic:notEmpty name="allBug">
    78:    <logic:iterate name="allBug" id="bug" type="bug.entity.Bug">
    79: <tr>
    80:         <td style="word-break: break-all;" >
    81:         <bean:write property="id" name="bug"/>


    An error occurred at line: 78 in the jsp file: /biye/showBug.jsp
    bug.entity.Bug cannot be resolved to a type
    75:    <td style="background-color: #808080;font-size: 12pt;color: #ffffff;font-weight: bold;line-height: 15pt;border: 1px solid #808080;"> <bean:message key="message.delete"/> </td>
    76:    </tr>
    77: <logic:notEmpty name="allBug">
    78:    <logic:iterate name="allBug" id="bug" type="bug.entity.Bug">
    79: <tr>
    80:         <td style="word-break: break-all;" >
    81:         <bean:write property="id" name="bug"/>


    An error occurred at line: 280 in the generated java file
    bug.entity.Bug cannot be resolved to a type

    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:423)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 09:29:072楼 得分:0
    没有这个bug.entity.Bug类
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 09:36:413楼 得分:0
    同意楼上。
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 09:58:564楼 得分:0
    有啊,bug.entity.Bug这个包是我编写的啊,怎么不能解析的?
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 10:39:325楼 得分:0
    从错误信息来看就是bug.entity.Bug这个类没有引入的关系,再去仔细检查一下代码
    在jsp中去掉这个类的引用再调试下,如调试通过,再从这个类上面着手查问题
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 10:54:196楼 得分:0
    把你的java编译好的class 复制到
    WEB-INF/classes
    下面
    ,如果是eclipse ,请参考这个
    http://www.java2000.net/viewthread.jsp?tid=700
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • dracularking
    • 等级:
    发表于:2008-03-16 11:57:037楼 得分:0
    你可以单独使用这个Type来测试下
    type="bug.entity.Bug"

    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 14:30:318楼 得分:0
    如果bug.entity.Bug这个类是LZ你自己写的话那就是没有被正确导入~~程序找不到~~
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 14:32:419楼 得分:0
    确定你的类路径和类放置的位置都正确~~另外LZ你可以试试在 <%@PAGE IMPORT%>引入详细的类~~
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-16 22:58:1110楼 得分:0
    不知道struts的application.properties怎么写
    我想可能是这里面错了,但不会unicode码
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-17 08:14:3111楼 得分:0
    struts1.1中logic:iterate的属性type指的是定义了集合中保存的类型,而我的bug.entity.Bug就是Bug.java,这是一个javabean
    完全符合呀,而且.properties文件我也是编号unicode码了的啊,怎么会错呢?
    application.properties文件内容如下:
      #错误信息
      error.eventcodeRequest= <tr> <td> <strong>必须有编号 </strong> </td> </tr>
      error.sqlAddError= <tr> <td> <strong>添加失败 </strong> </td> </tr>
      error.sqlDelError= <tr> <td> <strong>删除失败 </strong> </td> </tr>
     
      #显示信息
      message.bugDB=信息插入
      message.id=编号
      message.sta=状态
      message.url=地址
      message.pha=阶段
      message.cat=类别
      message.ref=参考
      message.dis=备注
      message.search=查询
      message.add=增加
      message.delete=删除
      message.bug=信息插入
     

    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    发表于:2008-03-17 08:22:0712楼 得分:0
    struts1.1中logic:iterate的属性type指的是定义了集合中保存的类型,而我的bug.entity.Bug就是Bug.java,这是一个javabean
    完全符合呀,而且.properties文件我也是编号unicode码了的啊,怎么会错呢?
    application.properties文件内容如下:
      #错误信息
      error.eventcodeRequest= <tr> <td> <strong>必须有编号 </strong> </td> </tr>
      error.sqlAddError= <tr> <td> <strong>添加失败 </strong> </td> </tr>
      error.sqlDelError= <tr> <td> <strong>删除失败 </strong> </td> </tr>
     
      #显示信息
      message.bugDB=信息插入
      message.id=编号
      message.sta=状态
      message.url=地址
      message.pha=阶段
      message.cat=类别
      message.ref=参考
      message.dis=备注
      message.search=查询
      message.add=增加
      message.delete=删除
      message.bug=信息插入
     

    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    北京创新乐知广告有限公司 版权所有 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright © 2000-2008, CSDN.NET, All Rights Reserved