日期:2014-05-17  浏览次数:20769 次

关于Cannot find bean under name 的异常

MyAction.java
Java code

List<Type> typelist = typeService.getTypes();
request.setAttribute("tlist", typelist);
return mapping.findForward("search");



search.jsp
Java code

<logic:notPresent name="tlist" scope="request">
    <jsp:forward page="searchProduct.do"></jsp:forward>
</logic:notPresent>
<html:select property="type">
    <html:option value="">全部类别</html:option>
    <html:options name="tlist" property="TNo" labelProperty="TName"/>
</html:select><html:errors property="type"/>



在jsp页面中找不到"tlist",如果不去掉logic标签,会出现死循环,去掉后会出现Cannot find bean under name tlist的异常。我单步调试,request 的attributes中已经正确存入了typelist的对象了。请高手指点啊


------解决方案--------------------
HTML code

<logic:notPresent name="tlist">
<html:select property="type">
    <html:option value="">全部类别</html:option>
    <html:options collections="tlist" property="TNo" labelProperty="TName"/>
</html:select><html:errors property="type"/>
</logic:notPresent >

------解决方案--------------------
<html:options name="tlist" property="TNo" labelProperty="TName"/>
这个里面的 tlist 没找到

3L 已经说到了 就再罗嗦一下
------解决方案--------------------
是你actionform中的问题,不存在这个
<html:select property="type">


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

List <Type> typelist = typeService.getTypes(); 
request.setAttribute("tlist", typelist); 

应该写到formBean 的 reset 方法里
------解决方案--------------------
你好像只在action里set进去你要传到页面的值了
但在页面并没有接收
<%List list = request.getAttribute("tlist");/%>
这样写接收下试试
------解决方案--------------------
先用<%List list = request.getAttribute("tlist");/%> 
接受 看看里面是不是有值 有值的话就说明你
search.jsp页面错误 
引入标签库了吗 
<logic:notPresent name="tlist" scope="request" 是不是这里有个type=""> 
<jsp:forward page="searchProduct.do"> </jsp:forward> 
</logic:notPresent>