sturts1.1框架struts-config.xml
<form-beans>
<form-bean name="checkTimeForm" type="cn.web.form.CheckTimeForm"></form-bean>
</form-beans>
<action path="/time"
name="checkTimeForm"
scope="request"
type="cn.web.action.CheckTimeAction">
<forward name="admin_web" path="/admin_web.jsp"></forward>
</action>ation:
List weblist = ls.checkTime(web_time);
request.setAttribute("weblist",weblist);
forward = mapping.findForward("admin_web");jsp:
<%
List weblist = (List)request.getSession().getAttribute("weblist");
System.out.println("-------admin_web.jsp----->>>weblist: "+weblist);
%>在tomcat后台打印
-------admin_web.jsp----->>>weblist: null
是null值那里错了吗。
<form-beans>
<form-bean name="checkTimeForm" type="cn.web.form.CheckTimeForm"></form-bean>
</form-beans>
<action path="/time"
name="checkTimeForm"
scope="request"
type="cn.web.action.CheckTimeAction">
<forward name="admin_web" path="/admin_web.jsp"></forward>
</action>ation:
List weblist = ls.checkTime(web_time);
request.setAttribute("weblist",weblist);
forward = mapping.findForward("admin_web");jsp:
<%
List weblist = (List)request.getSession().getAttribute("weblist");
System.out.println("-------admin_web.jsp----->>>weblist: "+weblist);
%>在tomcat后台打印
-------admin_web.jsp----->>>weblist: null
是null值那里错了吗。
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%>我是用myEclipse做的这个项目。
----CheckTimeAction----
-----进来了吗------
-----web_time----2008-11-1
>>>>>>>>checkTime_sql= SELECT id,name,time,information,ct,sh,total,jiucuo FROM w
eb WHERE time='2008-11-1';
---CheckTimeAction------setAttribute------[cn.model.Web@67ec28, cn.model.Web@c14
29c, cn.model.Web@1fc3828, cn.model.Web@1cb048e, cn.model.Web@1983ad7, cn.model.
Web@13f348b, cn.model.Web@92997e, cn.model.Web@9b601d, cn.model.Web@c3362f, cn.m就是在跳转到jsp后。获得不到了。
<logic:iterate id="web" property="weblist">这个property="weblist" 就是我在action定义的request.setAttribute("weblist",weblist);
前台报500错误
java.lang.NullPointerException: Null attribute name
------>>>>
List weblist = (List)request.getAttribute("weblist");
List weblist = (List)request.getAttribute("weblist");
用它一样获取不到
是null <table border="1">
<tr>
<td>id</td>
<td>客户名称</td>
<td>日期</td>
<td>信息费</td>
<td>长途费</td>
<td>本市话费</td>
<td>合计</td>
<td>纠错</td>
</tr>
<logic:iterate id="web" property="weblist">
<td>
<html:multibox property="id">
<bean:write name="web" property="id"/>
</html:multibox>
</td>
<td><bean:write name="web" property="name"/></td>
<td><bean:write name="web" property="time"/></td>
<td><bean:write name="web" property="information"/></td>
<td><bean:write name="web" property="ct"/></td>
<td><bean:write name="web" property="sh"/></td>
<td><bean:write name="web" property="total"/></td>
<td><bean:write name="web" property="jiucuo"/></td>
</logic:iterate>
你放在请求范围里怎么可能取不到 除非你在forward时 设置了rediret=true