如何从网址中删除扩展名 [英] How to remove the extensions from url

查看:154
本文介绍了如何从网址中删除扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用struts2设计了一个应用程序,需要删除扩展名,例如

I have designed an application using struts2, and need to remove the extensions for example

www.myweb.com/register.action

如何删除.action,所以当我点击注册时,请致电www.myweb.com /注册没有行动延期?

How to remove the .action so when I click on register it call www.myweb.com/register without action extension?

我使用以下

 <a href="<s:url action="register"/>">Register</a> 


推荐答案

我找到了答案。我应该更改struts配置如下:

I've found the answer. I should change the struts configuration as following:

<struts>



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



    <package name="default" extends="struts-default">

        <action name="register">
            <result type="tiles">register</result>
        </action>
    </package>


</struts>

这篇关于如何从网址中删除扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆