急!

chendy7730 2004-10-28 05:09:48
最近在学j2ee. 偶在做动态下拉筐读取数据库信息的时候经常出现错误: Cannot find bean under name projectList............请高手指教.........
...全文
69 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
chendy7730 2004-10-28
各位大哥帮小弟看一下,实在是不行了偶!!!!!!
谢了!!
回复
chendy7730 2004-10-28
ActionForm代码如下:

if (act.equals("queryall")) { //查找所有记录
System.out.print("*******************************");
List projectLists = cmsProjectInfoSession.findAll();

ArrayList projectList = new ArrayList();

int count = 0;
if (projectLists != null && projectLists.size() > 0) {
count = projectLists.size();
for (int i = 0; i < projectLists.size(); i++) {
CmsProjectInfoActionForm tempForm = new CmsProjectInfoActionForm();
cmsProjectInfo = (CmsProjectInfo) projectLists.get(i);

BeanUtils.copyProperties(tempForm, cmsProjectInfo);

projectList.add(new LabelValueBean(cmsProjectInfo.getProjectId(),cmsProjectInfo.getProjectName()));

}
}
Iterator projectIter = projectList.iterator();
request.setAttribute("count", String.valueOf(count));
request.setAttribute("projectInfo", projectIter);
request.setAttribute("projectList",projectIter);

action = "project_information_view";
回复
chendy7730 2004-10-28
JSP代码如下:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ page contentType="text/html; charset=gb2312" %>
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="../css/default/css.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../scripts/cms/resource/project_main.js"></script>
</head>
<body>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<html:form action="/cmsProjectInfoAction.do?act=queryall" method="post" scope="request" >
<tr>
<td height="22" valign="bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="4%"> </td>
<td colspan="4"> <img src="../images/a/flag.gif" width="17" height="17" align="absmiddle"> 当前项目:
<html:select name="cmsProjectInfoActionForm" property="projectName">
<html:options collection="projectList" property="label" labelProperty="value"/>
</html:select></td>

<td width="19%"> </td>
<td width="17%"> </td>
<td width="10%"><a href="javascript:_do_action(0)" class="B3"><img src="../images/a/message/new.gif" width="11" height="14" border="0" align="absmiddle"> 查看</a> <img src="../images/a/bline.gif" align="absmiddle"></td>
<td width="10%"><a href="javascript:_do_action(1)" class="B3"><img src="../images/a/message/new.gif" width="11" height="14" border="0" align="absmiddle"> 新建</a> <img src="../images/a/bline.gif" align="absmiddle"></td>
<td width="10%"><a href="javascript:_do_action(2)" class="B3"><img src="../images/a/message/new.gif" width="11" height="14" border="0" align="absmiddle"> 修改</a> <img src="../images/a/bline.gif" width="2" height="12" border="0" align="absmiddle"></td>
<td width="10%"><a href="javascript:info_frame.list_frame.cmsProjectInfoActionForm.submit();" class="B3"><img src="../images/a/message/del.gif" width="13" height="13" border="0" align="absmiddle"> 删除</a></td>
</tr>
<tr>
<td> </td>
<td width="30">退后</td>
<td width="30">向上</td>
<td width="30">撤消</td>
<td>当前目录: </td>
<td><input type="text" name="textfield"></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</html:form>
</table>
</td>
</tr>

<tr>
<td height="*" valign="top"><iframe id="info_frame" height="100%" width="100%" align="middle" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" src="../cmsProjectInfoAction.do?act=newproject" style="border-bottom-color:#F3EFED "></iframe></td>
</tr>
</body>
</html:html>
回复
victorylj 2004-10-28
你编的javaBean有没有打包?
把完整代码发上来
回复
victorylj 2004-10-28
可能是javaBean编译后的class文件找不到。你存放文件的路径是怎样的?
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告