显示数据,报错说找不到bean,大家帮忙看看是什么原因!!!!!!!!!谢谢

litingz 2005-10-19 05:39:18
userlist.jsp


<logic:iterate id= "element " indexId= "index " name= "user " >
<tr >
<td height= "32 " > <bean:write name= "index "/ > </td >
<td > <bean:write name= "element " property= "userID "/ > </td >
<td > <bean:write name= "element " property= "password "/ > </td >
<td >
<html:form method= "post " action= "/alteruser.do " >
<html:submit >変更 </html:submit >
</html:form >
</td >
<td >
<html:form method= "post " action= "/deleteuser.do " >
<html:submit >削除 </html:submit >
</html:form >
</td >
</tr >
</logic:iterate >




userlistAction.java


UserForm userForm = (UserForm) form;
ResultSet rs=null;
rs=DB.executeQuery( "select USERID,PASSWORD from USER_T ");
System.out.println( "1234 ");

Vector user=new Vector();
while(rs!=null&&rs.next())
{
user.addElement(new User(rs.getString("USERID"),rs.getString("PASSWORD")));
}
request.setAttribute( "user ",user);
return mapping.findForward( "userlist ");




struts-config.xml


<action
attribute= "user "
path= "/userlist "
type= "struts.zhengliting.action.UserListAction "
validate= "false " >
<forward name= "userlist " path= "/page/zhengliting/userlist.jsp " / >
</action >
...全文
227 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
litingz 2005-10-28
  • 打赏
  • 举报
回复
这个问题到现在还是没有解决,我交给同组的高手了,不知道什么时候能调出来
litingz 2005-10-24
  • 打赏
  • 举报
回复
to brucejia(大碗喝酒,大块吃肉) :在config中都有定义;

用<logic:present>进行判断是否定的,如果用<bean:defined>先定义再进行判断就不是否定,但一样报错找不到bean。

to kwuly(THE木) :
在什么地方加打印代码啊?

不好意思,我下午在忙程序的其它部分就没到这来,谢谢大家对我的帮助,错误还是没调出来,我要疯了,希望我不会老的太快。
lilome 2005-10-24
  • 打赏
  • 举报
回复
要先用logic:present标签判断一下
lilome 2005-10-24
  • 打赏
  • 举报
回复
代码没问题,应该访问userlist.do,如果访问userlist.jsp就肯定会出错了
rzty 2005-10-24
  • 打赏
  • 举报
回复
你在<logic:iterate id= "element " indexId= "index " name= "user " >使用的这个index,用<bean:defined>定义一下,或者<%int index=0;%>这样定义一下先。
kwuly 2005-10-24
  • 打赏
  • 举报
回复
你可以打印user的值看是不是为空!为空时的报错也是bean不存在的!!
喝酒吃肉 2005-10-24
  • 打赏
  • 举报
回复
alteruser.do,deleteuser.do在struts-config.xml定义了吗
innowy 2005-10-24
  • 打赏
  • 举报
回复
区分大小写
shuly 2005-10-21
  • 打赏
  • 举报
回复
<logic:iterate indexId= "index " name= "user "
type="a.b.c.d.Form"> 此处应该写明你的Bean或者Form的类名

否则计算机不会知道应该把你的element里面的Object转化成什么的。
另外,jsp区分大小写
litingz 2005-10-21
  • 打赏
  • 举报
回复
还是同样的错误,
"element "是没有空格的,是我往上贴的时候产生的,在程序中是没有的
high_land 2005-10-21
  • 打赏
  • 举报
回复
好用吗? 结果告诉偶?
high_land 2005-10-21
  • 打赏
  • 举报
回复
<bean:write name= "element " property= "userID "/ >
改为
<bean:write name= "element" property= "userID"/ >
bixuehui 2005-10-20
  • 打赏
  • 举报
回复
不好意思,我看错了.
bixuehui 2005-10-20
  • 打赏
  • 举报
回复
request.setAttribute( "user ",user); 改为:
request.setAttribute( "element",user);
litingz 2005-10-20
  • 打赏
  • 举报
回复
我想在adduser.jsp页中显示所有数据,以上的代码也是我自已照书改的。
大家有什么好方法吗?大家现在都上MSN吗,我的是zhengliting_9@hotmail.com
litingz 2005-10-20
  • 打赏
  • 举报
回复
minmin0127(情与泪):
<bean:write name= "index "/ >
我想在表单里的内容输出之前先输出序号;


kemin(可名):如何配置?


我还是个新手,刚刚工作,以前在学校也没学过struts,都是到单位才学的,现在都是遇到问题先查书,再上网查,再根据原有的代码加以修改。请各位前辈多多指点啊!多谢。
litingz 2005-10-20
  • 打赏
  • 举报
回复


user类只是一些基本的get,set

public class User implements Serializable {
private String password;
private String confirmpassword;
private String userID;

public User() {}

public User(String userID,String password,String confirmpassword) {
this.userID=userID;
this.password=password;
this.confirmpassword=confirmpassword;
}

public User(String userID,String password){
this.userID=userID;
this.password=password;
}

public void setPassword(String password) {
this.password=password;
}

public void setConfirmpassword(String confirmpassword){
this.confirmpassword=confirmpassword;
}

public void setUserID(String id) {
this.userID=id;
}

public String getPassword() {
return password;
}

public String getConfirmpassword() {
return confirmpassword;
}

public String getUserID() {
return userID;
}
}
litingz 2005-10-20
  • 打赏
  • 举报
回复
没有什么不好意思的,大家都是在帮我的忙啊。谢谢了!
喝酒吃肉 2005-10-19
  • 打赏
  • 举报
回复
把User类贴出来
minmin0127 2005-10-19
  • 打赏
  • 举报
回复
<bean:write name= "index "/ >为什么要有这一句呢??还有就是Vector他是同步的!我建议用Collection resultList = new ArraryList();
加载更多回复(2)

81,095

社区成员

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

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