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

struts1如何将form中的值显示到jsp页面中
form中定义了一个实体 在action中set实体的值 怎么用<bean:write>将实体中的属性显示到jsp页面中 我用的<bean:write name="entity" property="entName"/>取不出来 求大神指教!!!!

------解决方案--------------------
你在action中,有把这个实体,放入 request 或 session 中么?

可以指定你实体存放的域,比如:
<bean:write name="entity" property="entName" scope="request"/>
相当于(这里忽略了类型转换):
<%=request.getAttribute("neeke").getEntName()%>
------解决方案--------------------
Action中至少要:
request.setAttribute("entity", bForm.getEntity);
------解决方案--------------------
formbean作用把页面的值放到formbean中,然后传给action,返回的时候,不使用formbean