求救,struts裡logic:iterate的問題!

aone0808發表於2005-03-19
action裡面的部分:
public ActionForward perform(ActionMapping mapping,ActionForm form,
HttpServletRequest request,HttpServletResponse response)
throws IOException,ServletException
{
Connection con=null;

try
{
con=pool.getConnection();

AttractionDAO attrationDAO=new AttractionDAO(con);
Collection col=attrationDAO.findAll();

request.setAttribute("attractionList",col);//在這兒

return mapping.findForward("success");
}
catch(SQLException e)
{
e.printStackTrace();
throw new RuntimeException("Unable to get connection.");
}
finally
{
try
{
if(con!=null)
{
con.close();
}
}
catch(SQLException e)
{
throw new RuntimeException(e.getMessage());
}
}
}


頁面呼叫的部分

<logic:iterate id="attraction"
name="attractionList"
scope="request"
type="com.wrox.tourism.entity.Attraction">

<tr>
<td><bean:write name="attraction" property="name"/></td>
<td><bean:write name="attraction" property="description"/></td>
</tr>

</logic:iterate>

就這樣沒有結果輸出(我的)
我在頁面加上try{}catch{}後
在後臺列印出 can't find bean attraction in scope null

為什麼會是scope null呢??????????、

相關文章