Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top