I am a beginner in Struts 2 and I am stuck in an issue, I would like to access an .xml
file in the project doc
, when the user goes to the link www.sitename.com/sitemap.xml
. But right now I can only access it by going to the URL www.sitename.com/sitemap
, i.e. without the extension. When I specify the action name as sitemap.xml
it does not work. How could I make the user access the URL www.sitename.com/sitemap.xml
. Sorry If the question does not make any sense.
Asked
Active
Viewed 496 times
1
-
http://stackoverflow.com/q/17293115/1700321. – Aleksandr M May 09 '14 at 07:50
1 Answers
1
The standard extension in Struts 2 for action name is .action
. But it's configurable via using a setting struts.action.extension
. It's available in the default.properties
, which is used by the default action mapper.
You might use a comma separated list, e.g. struts.action.extension=action,xml,whatsoever
The blank extension used to map directories treated as action names. Static content is mapped via specifying a blank extension, e.g. struts.action.extension=
, or struts.action.extension=a,b,c,,
, or struts.action.extension=a,,b,c
.

Roman C
- 49,761
- 33
- 66
- 176
-
thanks a lot for you reply@Roman.But i would like to ask if a doubt,If i have an action named "home" and i have changed my `struts.action.extension` as you said,does that mean i can access my home page as home.xml.?? – Nibin May 09 '14 at 08:50
-
You can only provide extensions listed by your configuration settings, when you make a request an extension will be extracted from url and added to action mapping. – Roman C May 09 '14 at 08:57
-
Is there some way by which i could provide an extension for a particular action call..?? – Nibin May 09 '14 at 09:00
-
1You can only provide the extension in `struts.xml` or `struts.properties`. – Roman C May 09 '14 at 09:02