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

struts首页信息显示问题 (全标签)
当进入首页面的时候显示的信息怎么去做啊?
dao得到数据交给bean 页面显示 数据

------解决方案--------------------
用html标签做个jsp,然后再加入structs的html的标签
------解决方案--------------------
1.主要是通过Form 表单中getProperty()属性来显示;
2.对Form表单中没有的一些特殊属性,可以通过保存在request/session后,用<bean:write name="" property=""/>来显示,
------解决方案--------------------
step1: 在Action中用findAll()方法找出所有.

step2: 建立HttpSession.

step3: 将找出来的集合放在HttpSession中.

step4: 在页面中用jstl的forEach把显示出来.
------解决方案--------------------
struts-tiles可以满足你的需要。其实也是调用了若干个action,用来填充页面内容

具体你可以baidu一下。有很多这样的应用的
------解决方案--------------------
1.你可以在web-xml设个欢迎页面
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
2.然后在index.jsp加上<logic:forward name="index"/>
3.在struts-config中配置:
<global-forwards >
<forward name="index" path="/showAll.do"></forward>
</global-forwards>

<action path="/showAll"
scope="request"
type="com.test.struts.action.ShowAllAction">
<forward name="success" path="/showAll.jsp" />
</action>
4.成功跳转到显示页面showAll.jsp。
此时浏览器中的地址仍然是http://localhost:8080/工程名/index.jsp