日期:2014-05-18  浏览次数:20706 次

求助!!!!!!struts传值问题
各位大哥帮忙看一下问题在哪

程序目的:jsp中接收Action的赋值。相关代码如下:

1.AreaAction.java中赋值

Collection   coll   =   new   ArrayList();
coll   =   db.select(..);
if   (coll   ==   null   ||   coll.isEmpty())
{return   actionMapping.findForward( "fail ");
}else

{
request.setAttribute( "Area ",   coll);
return   actionMapping.findForward( "success ");
}

2.jsp4.jsp中获取   Area的值

<logic:iterate   id= "area "   name= "Area "   >
<tr   valign= "top "   bgcolor= "#FFFFFF ">
<td   height= "20 "   align= "center "   bgcolor= "#FFFFFF "> <bean:write   name= "area "   property= "name "   filter= "true "/> </td>
<td   height= "20 "   align= "center "   bgcolor= "#FFFFFF "> <bean:write   name= "area "   property= "resume "   filter= "true "/> </td>
</tr>
</logic:iterate>

3.struts-config.xml配置action-mapping

<action   path= "/areaAction "   type= "com.cargo1.control.AreaAction "   validate= "false "   scope= "request ">
<forward   name= "success "   path= "/jsp4.jsp "   />
</action>

<action   path= "/areaAction "   type= "com.cargo1.control.AreaAction "   validate= "false ">
<forward   name= "fail "   path= "/jsp1.jsp "   />
</action>

问题:运行jsp4.jsp时从request中找不到Area,错误提示如下:
javax.servlet.ServletException:   Cannot   find   bean   Area   in   scope   null”

那位大哥帮帮忙给小弟解释一下,万分感谢


------解决方案--------------------


request.getSession().setAttribute( "Area ", coll);