webwork或Struts配置网站根路径的默认页面办法

参考资料:http://www.iteye.com/problems/24028

查阅好多资料,关于webwork或Struts处理默认页面的方式,能否像spring MVC那样直接指定默认访问页面。非要在web.xml中配置welcome-file。

也许是我愚钝,还未掌握其精髓。又也许是我习惯了spring MVC。反正我很讨厌webwork或Struts的对默认页面的做法。

<welcome-file-list>
    <welcome-file>index.htm</welcome-file>
</welcome-file-list>

既然这样,没有办法了,在根目录下方个index.htm静态文件,书写如下内容:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>  
<head>  
<meta    http-equiv="Content-Type"    content="text/html; charset=UTF-8" />
<meta    http-equiv="expires"    content="Mon, 06 Jan 1990 00:00:01 GMT" />
<meta    http-equiv="refresh"    content="0;url=index.action"/>  
</head>  
</html>

其中url=index.action是想要跳转的动态地址。像我做手机页面的就是wap.html2(外包公司搞了个html2的奇葩后缀^_^)。

先这么用着。

原文地址:https://www.cnblogs.com/luodengxiong/p/5000843.html