<s:select /> 传一个list值报错
答案:2 悬赏:0 手机版
解决时间 2021-04-13 23:21
- 提问者网友:佞臣
- 2021-04-13 11:58
2010-7-3 18:02:14 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet jsp threw exceptiontag 'select', field 'list', name 'typename': The requested list key '#booktypelist' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location] 我booktypelist是在action 中的public String findselects() { booktypelist = (List)booktypebiz.findselect(); System.out.println(booktypelist.get(1)); System.out.println(booktypelist.size()); ActionContext.getContext().put("list", booktypelist); return "success"; } system。out。pringln都打印出来了的com.ssh.book.hibernate.BookType@b706485
最佳答案
- 五星知识达人网友:酒安江南
- 2021-04-13 12:07
system.out.println打印booktypelist当然是com.ssh.book.hibernate.BookType@b706485,因为它是一个对象,只能继续点才能有值,例:((bean的类型)booktypelist.get(1)).get属性方法,我不知道你界面是怎么写,一般是可以的,我觉的用request更好,你那个application不安全,例:HttpServletRequest request=HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("list", booktypelist);
request.setAttribute("list", booktypelist);
全部回答
- 1楼网友:平生事
- 2021-04-13 12:40
<s:select label="商品类别" list="#booktypelist" listkey="typeid" listvalue="typeid" name="typename"></s:select>
这句话有错啊,你的actioncontext.getcontext().put("list", booktypelist);你是以list为key传值到页面的,你在使用变量名booktypelist当然就不行了,你改下actioncontext.getcontext().put("booktypelist", booktypelist);在试下。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯