---
title: "修改struts2中action的拓展名"
author: "lectery"
date: "2010-09-26T12:26:33Z"
tags: []
categories: ["企业架构"]
slug: "struts2-action"
draft: false
lastmod: "2010-09-26T12:27:41Z"
id: 771960
url: "https://lectery.iteye.com/blog/771960"
---

struts2中action的默认拓展名是".action"，而之前的拓展名一直为".do"，工作中需要要把struts2的action拓展名改为".do"的形式，查了一下，找到两种方法：

 

1. 在struts.xml中进行如下配置  
    &lt;constant name="struts.action.extension" value="do" /&gt;
2. 在web.xml的filter中进行配置&lt;init-param&gt;
   
   ```
   <param-name>struts.action.extension</param-name>
   <param-value>do</param-value>
   </init-param>
   ```