如题。
还有个问题需要大家解决:就是网站的地址容错率:
假设我的网站是
http://localhost/myWeb
我的struct.xml如此配置: <package name="back" namespace="/all" extends="struts-default">
<action name="*_*" class="action.{1}Action" method="{2}">
<result name="success"> /WEB-INF/jsp/{1}/{1}_{2}_success.jsp</result>
<result name="error"> /WEB-INF/jsp/{1}/{1}_{2}_error.jsp</result>
</action>
</package>
<!--这里是为了容错的-->
<package name="a" namespace="" extends="struts-default">
<action name="*">
<result>/error.html</result>
</action>
</package>如果不写下面那个package,如果我访问:
http://localhost/myWeb/xxx/xx/xx/xxx(或xxx.action)
那么就会出错,不友好。下面那个package是为了容错
写了,如果我访问上述网页,就会提交到我下面的里面
但是我的error.jsp是没有的,因为我在web.xml中配置了: <error-page>
<error-code>400</error-code>
<location>/WEB-INF/errors/fileNotFind.jsp</location>
</error-page>
<!-- 404 页面不存在错误 -->
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/errors/fileNotFind.jsp</location>
</error-page> 找不到error.jsp页面,属于404错误,就会返回fileNotFind.jsp页面。
但是这有个问题,如果我访问的是:
http://localhost/myWeb/xxx/../xxx.任意后缀名
如果不存在的话,就会自动转到的我的fileNotFind.jsp
这里的漏洞就是:
http://localhost/myWeb/all/xx/xx
就会有问题,这个请求会提交到第一个package
那怎么办?
我的意思你们明白吗?我在线等。
还有个问题需要大家解决:就是网站的地址容错率:
假设我的网站是
http://localhost/myWeb
我的struct.xml如此配置: <package name="back" namespace="/all" extends="struts-default">
<action name="*_*" class="action.{1}Action" method="{2}">
<result name="success"> /WEB-INF/jsp/{1}/{1}_{2}_success.jsp</result>
<result name="error"> /WEB-INF/jsp/{1}/{1}_{2}_error.jsp</result>
</action>
</package>
<!--这里是为了容错的-->
<package name="a" namespace="" extends="struts-default">
<action name="*">
<result>/error.html</result>
</action>
</package>如果不写下面那个package,如果我访问:
http://localhost/myWeb/xxx/xx/xx/xxx(或xxx.action)
那么就会出错,不友好。下面那个package是为了容错
写了,如果我访问上述网页,就会提交到我下面的里面
但是我的error.jsp是没有的,因为我在web.xml中配置了: <error-page>
<error-code>400</error-code>
<location>/WEB-INF/errors/fileNotFind.jsp</location>
</error-page>
<!-- 404 页面不存在错误 -->
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/errors/fileNotFind.jsp</location>
</error-page> 找不到error.jsp页面,属于404错误,就会返回fileNotFind.jsp页面。
但是这有个问题,如果我访问的是:
http://localhost/myWeb/xxx/../xxx.任意后缀名
如果不存在的话,就会自动转到的我的fileNotFind.jsp
这里的漏洞就是:
http://localhost/myWeb/all/xx/xx
就会有问题,这个请求会提交到第一个package
那怎么办?
我的意思你们明白吗?我在线等。
解决方案 »
- eclipse3.6J2EE版中的WEBService开发方式?
- There is no Action mapped for action name .xxx - [unknown location]
- MINA下关于udp的消息回复
- entity 怎么定义组合主键
- 文件打包下载
- hibernate的异常,求解,
- poi读excel出现了问题
- myeclipse的uml编辑器打开任何东东都报错 为什么啊 急急急!!!!!!!!!!!!!
- 如何处理读取一个动态页面的内容?页面内可能会有检查cookie,或者检查页面是否直接访问
- myeclipse里创建web工程 我JDK自己安装的是1.7 但是MYECLIPSE的JAVAEE最多只能是JAVAEE6.0
- MANYTOMANY 中间表 的关系 删除
- Hibernate使用级联的问题?
<constant name="struts.i18n.encoding" value="UTF-8" />
<!--struts.objectFactory 将操作交给Spring去做 -->
<constant name="struts.objectFactory" value="spring" />
<!-- 设置Action访问时的扩展名 -->
<constant name="struts.action.extension" value="php,htm,asp" />
<!-- 开发模式,提供更友好的排错信息和自动重新加载配置文件 -->
<constant name="struts.devMode" value="true" />
<package name="itv" extends="struts-default">
<action name="*Live" method="{1}"
class="channelAction">
<result name="list">/Live.jsp</result>
<result name="input">/Live.jsp</result>
</action>
<action name="*Demand" method="{1}"
class="categoryAction">
<result name="listTitle">/Demand.jsp</result>
<result name="input">/index.jsp</result>
</action>
<action name="*Review" method="{1}"
class="reviewAction">
<result name="list">/Review.jsp</result>
<result name="input">/Review.jsp</result>
</action>
<action name="*Share" method="{1}"
class="shareAction">
<result name="friends">/share_friends.jsp</result>
<result name="shar">/share_ok.jsp</result>
<result name="share">/Share.jsp</result>
<result name="empty">/share_friends.jsp</result>
<result name="add">/add_friend.jsp</result>
<result name="input">/Review.jsp</result>
</action>
<action name="*Action" method="{1}"
class="collectionAction">
<result name="myItv">/MyItv.jsp</result>
<result name="input">/index.jsp</result>
</action>
<action name="*Member" method="{1}"
class="memberAction">
<result name="find">/add_friend.jsp</result>
<result name="forword">/forword.jsp</result>
<result name="input">/index.jsp</result>
</action>
</package>
<error-code>404</error-code>
<location>/WEB-INF/errors/fileNotFind.jsp</location>
</error-page>
怎么了?