welcome-list中index.action无效.
只能用index.jsp或者index.htm如果在welcome-list里用index.jsp或者index.htm,在index.jsp中用 sendRedirect("XXX")或者在index.htm中用<meta http-equiv="content-type" content="0; url">倒是可以实现首页的导向, 但是这样对搜索引擎太不友好,,我想大网站肯定不是这样弄的.我试了 url重定向也不行,如果把"/"重定向到"/index.action",那么站点下所有目录都成了"/index.actionTestImg.gif"这样的.到底应该怎么弄呢.....
只能用index.jsp或者index.htm如果在welcome-list里用index.jsp或者index.htm,在index.jsp中用 sendRedirect("XXX")或者在index.htm中用<meta http-equiv="content-type" content="0; url">倒是可以实现首页的导向, 但是这样对搜索引擎太不友好,,我想大网站肯定不是这样弄的.我试了 url重定向也不行,如果把"/"重定向到"/index.action",那么站点下所有目录都成了"/index.actionTestImg.gif"这样的.到底应该怎么弄呢.....
解决方案 »
- 求解决一XML问题
- jsp中 页面是使用的“UTF-8编码” 但在使用String name = request.getParameter("name") 得到的name为??乱码
- 关于网页正文提取的想法和疑问
- 谁能告诉我在Windows2003下怎样用Tomcat连接sqlserver2000。。。。。在此重谢。重谢。重谢。重谢。重谢
- JavaBean中staic方法的问题。
- 求sun.jdbc.rowset包和API参考资料
- 关于类信息的获取,判断问题
- 用jsp页面更新word文档,大家有什么好主意??
- 文章分享到新浪微博怎么做?
- tcp包数据监视
- jsf页面跳转的问题
- 关于MyEclipse 中连接SQL Server 2005出现的问题
<forward name="welcome" path="HelloWorld.do">
<global-forward>
然后创建一个名叫 welcome.jsp的Jsp文件(也可以采用其他文件名称),当该页面被加载时,
它把请求转发给以上<forward>元素指定的Action。welcome.jsp的代码如下:<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<body>
<logic:forward name="welcome">
</body>
</html>
最后在web.xml文件中把welcome.jsp文件配置为欢迎文件,代码如下:<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>
第一步:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern >/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>第二步:<jsp:forward page="index.action"></jsp:forward> 首页跳转语句
*.action 的 只要 要转发里面写绝对路径就行了。
第一步:
web.xml中修改
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern >/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>第二步:
web.xml中添加
<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>第三步:
首页跳转语句
welcome.jsp内容如下(就一句):
<jsp:forward page="/index.action"></jsp:forward>