struts2.0设置主页的方法



struts2.0设置主页的方法第一:在web.xml配置文件中配置要设成主页的页面
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
前提是在webroot
下写了一个index.html页面
(如果想要看到的不是页面,而是要转到一个action下
,那么可以在默认页面中转发,如下第二)
第二:在index.html页面中写明要转发到的地方
<meta
http-equiv=”refresh” content=”0; url=/product/gtgh/Index.action”
/>
注:如果url指向的是本页面,0改为其他的数意思则为每隔多长时间刷新一次页面
如果url指向的是其他的页面,content=”0则是重定向其他页面
方法二:
第一:如上
第二:在index.html页面中写明要转发到的地方(利用js)
<script
type=”text/javascript”>
parent.location.href=”http://www.baidu.com”
</script>
(parent也可以用top代替
也可以两个都不加,如果写上主要是为了大页面显示:主要是与iframe有关系)
parent.location.href=”*******************”写明要连接到的页面也可以是某个action