struts2是可以配置默认的后缀名的,如http://localhost:8080/test.action,这个是默认的,但是也可以通过配置去修改这个.action为别的。

这里是通过一个常量配置改变的。

<constant name="struts.action.extension" value="do"/>

这样的就会变为http://localhost:8080/test.do来访问。

但是我很不喜欢有后缀,百度了很多大家的结论一般都是使用SmartUrls和urlrewritefilter这两个解决,但是我只是想把后缀去掉而已,就让我增加别的组件这个实在很不爽,最后终于找到了个方法:

<constant name="struts.action.extension" value=","/>

在这里把value配置为,就可以使用http://localhost:8080/test完成访问了

把这段注释加上吧,大家可以看看

### Used by the DefaultActionMapper
### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
### The blank extension allows you to match directory listings as well as pure action names
### without interfering with static resources, which can be specified as an empty string
### prior to a comma e.g. struts.action.extension=, or struts.action.extension=x,y,z,,
struts.action.extension=action,,

关于struts2如何去掉默认的后缀(.action)的更多相关文章

  1. Struts2 无后缀action请求

    如果将Struts2的filter-mapping配置成 <filter-mapping> <filter-name>struts2</filter-name> & ...

  2. Struts2学习笔记三:深入Action

    一:Action中获取参数值 在Servlet中,我们通过doGet()/doPost()方法中的参数,获取request/response对象,然后提取参数值: 处理请求结束后,有数据需要携带返回客 ...

  3. struts2:数据校验,通过Action中的validate()方法实现校验(续:多业务方法时的不同验证处理)

    前文:struts2:数据校验,通过Action中的validate()方法实现校验,图解 如果定义的Action中存在多个逻辑处理方法,且不同的处理逻辑可能需要不同的校验规则,在这种情况下,就需要通 ...

  4. Struts2中<jsp:forward page="xxx.action"></jsp:forward>失效

    问题:在Struts2中<jsp:forward page="xxx.action"></jsp:forward>失效了,不但调转不过去还报404错误.不知 ...

  5. Struts2基础-1- 简单java类实现Action控制器

    Strut2中,Action可以不继承任何特殊的类或不实现任何特殊的接口,可以只编写一个普通的Java类作为Action类,只要该类含有一个返回字符串的无参的public方法即可!实际开发中,通常继承 ...

  6. struts2:数据校验,通过Action中的validate()方法实现校验,图解

    根据输入校验的处理场所的不同,可以将输入校验分为客户端校验和服务器端校验两种.服务器端验证目前有两种方式: 第一种 Struts2中提供了一个com.opensymphony.xwork2.Valid ...

  7. 如何去掉 Discuz标题后缀power by discuz

    如何去掉 Discuz标题后缀power by discuz 打开如下文件 template/default/common/header_common.htm/php 找到如下代码 $navtitle ...

  8. 百度小程序button去掉默认边框

    百度小程序button去掉默认边框: button::after{ border:none; }

  9. LaTeX去掉默认显示日期时间

    LaTeX去掉默认显示日期时间: \date{}

随机推荐

  1. IOS 模仿TableView封装

    一.先贴一下未封装的代号,好跟后面的对比 @interface MTHomeDropdown : UIView + (instancetype)dropdown; @property (nonatom ...

  2. 20150226--WebForm中GridView

    WebForm中的GridView的用法基本与winForm中的DataGridView一致, 其数据绑定的方法使用LinqDateSource 将GridView拖拽进网页中,出现以下格式: 自动套 ...

  3. 10款基于jquery的web前端特效及源码下载

    1.jQuery时间轴插件:jQuery Timelinr 这是一款可用于展示历史和计划的时间轴插件,尤其比较适合一些网站展示发展历程.大事件等场景.该插件基于jQuery,可以滑动切换.水平和垂直滚 ...

  4. 单元测试+修改BUG

    程序源代码: #include<iostream> using namespace std; int Largest(int list[], int length) { int i, ma ...

  5. 模板:abs用法

    c语言书本上说,数学函数除了求整数的绝对值函数abs()之外<abs() 定义在stdlib.h中>,其余的函数都在头文件 math.h 中定义,包括对浮点数求绝对值的函数fabs().c ...

  6. UINavigationController的popViewControllerAnimated问题

    UINavigationController是IOS编程中的一个view controller的容器,通过栈管理viewControllers,每一次push操作都将在栈顶添加一个view contr ...

  7. PHP 正则表达式替换一部分内容

    preg_replace('/&topic=(.*?)&type=/',"&topic={$data['topic']}&type=",$postF ...

  8. 另辟思路解决 Android 4.0.4 不能监听Home键的问题

    问题描述: 自从Android 4.0以后,开发人员是不能监听和屏蔽Home键的,对于KEYCODE_HOME,官方给出的描述如下: Home key. This key is handled by ...

  9. CentOS中查看物理CPU信息的方法

    1.概念 [1]物理CPU:实际Server中插槽上的CPU个数.物理cpu数量:可以数不重复的 physical id 有几个.[2]逻辑CPULinux用户对 /proc/cpuinfo 这个文件 ...

  10. WordPress 主题开发 - (二) 理解主题 待翻译

    What is “Theme Sense”? What is “Theme Sense”? Theme Sense is an intuitive understanding of WordPress ...