我在action bean里调用了一个自己创建的service实体类,然后在该类中得到一个arraylist,并用request.setAttribute("testresults",resultList)把它放到request中.
在jsp页面上可以用<%=request.getAttribute("testresults")%>显示出
[cn.com.DAOC.basedata.test.TestService@1e4e3e4, cn.com.DAOC.basedata.test.TestService@2dce4e, cn.com.DAOC.basedata.test.TestService@14382c6]
使用<bean:size id= "size" name= "testresults" scope= "request"/>也可以得到结果集是3条数据
在<logic:iterate id= "result" name= "testresults" scope= "request">也可以知道是3行数据
但是如果使用<bean:write name= "TestService" property= "tname" scope= "request"/>读取数据,就报出错误javax.servlet.ServletException: Cannot find bean TestService in scope request
请问一下该如何解决
在jsp页面上可以用<%=request.getAttribute("testresults")%>显示出
[cn.com.DAOC.basedata.test.TestService@1e4e3e4, cn.com.DAOC.basedata.test.TestService@2dce4e, cn.com.DAOC.basedata.test.TestService@14382c6]
使用<bean:size id= "size" name= "testresults" scope= "request"/>也可以得到结果集是3条数据
在<logic:iterate id= "result" name= "testresults" scope= "request">也可以知道是3行数据
但是如果使用<bean:write name= "TestService" property= "tname" scope= "request"/>读取数据,就报出错误javax.servlet.ServletException: Cannot find bean TestService in scope request
请问一下该如何解决
解决方案 »
- IntelliJ idea 菜单栏语言问题
- FineReport报表软件通过权限控制数据访问方案
- 请问Eclipse中怎样进行debug,希望大家提供视频下载地址或者自己的经验?谢谢
- mysql默认值问题
- ibatis3 resultMap中 <association 一对一关联查询,如果null怎么处理
- 如何用servlet文件,读取文件内容?请给一点提示代码。谢谢!
- 请问如何用JavaScript删除IE的历史记录?谢谢!
- 这个错误代表什么!!
- 请教如何在JSP中彻底关闭数据库连接(加急!!!)
- 为什么不能加参数!!!!!!!!!!!
- (linux下tomcat中)显示图片的路径问题,在线等!!!
- 新手求助一题JSP关于插入数据到表的练习题!谢谢各位咯~
这句话的意思是输出一个叫TestService的bean里面的tname的属性的值,问题是你有把TestService这个对象放在request里面么?
<logic:iterate id= "result" name= "testresults" scope= "request">
<bean:write name= "result" property= "tname" >
</logic:iterate>
如果scope为空的话,默认是从request里面取的
但是我如果在<bean:write name= "result" property= "tname"/ >里加了 scope= "request",就又报错误了
=============================================================
现在是pageContext了,当然是不在request了