---
title: "修改action的后缀 "
author: "=寂寞_狐狸="
date: "2011-12-19T11:33:36Z"
tags: []
categories: ["Web前端"]
slug: "action"
draft: false
lastmod: "2011-12-19T11:33:36Z"
id: 1316360
url: "https://fox-leon.iteye.com/blog/1316360"
---

struts2 的默认后缀是.action

虽然很直观，但是很烦琐。很多人喜欢将请求的后缀改为.do

 

在struts2中修改action后缀有两种比较简单的办法:

一、在 struts.properties 中修改。

如你想把后缀改为 .do 则 加上一行:struts.action.extension=do

至于加在第几行，应该没有关系，我加在第一行和最后一样都正常。

 

二、在struts.xml 中修改。

在 struts.xml 中加入一constant 节点 :

constant name="struts.action.extension" value="do"