• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
第二天半
博客园    首页    新随笔    联系   管理    订阅  订阅

struts配置请求后缀,将.action改为.do、.doaction_2015.01.04

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <!-- 将.action访问,改为.do、.doaction:同时处理这两种后缀 -->
    <constant name="struts.action.extension" value="do,doaction"></constant>
    
    <package name="hw" namespace="/test" extends="struts-default">
        <action name="helloworld" class="com.self.action.HelloWorldAction" method="dohelloworld" >
            <result name="doresult">
                /showresult.jsp
            </result>
        </action>
    </package>
</struts>

 

原访问地址:http://localhost:8080/Struts2_01/test/helloworld.action(改后访问404)
该后地址01:http://localhost:8080/Struts2_01/test/helloworld.do
该后地址02:http://localhost:8080/Struts2_01/test/helloworld.doaction

posted @ 2015-01-04 23:01  第二天半  阅读(480)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3