Friday, 7 March 2014

Change Extension in Struts2



Struts web application provides default extension as “.action” in each http request and response URL.

For example:

    http://localhost:8080/test.action

But it can be replace with any another extension like JSP, HTML or any user defined name
There are two way to change it to our own extension.
   
First Way:

Set constants into its Struts configuration file “struts.xml”: 

Second Way:

Set into struts properties file:

    struts.action.extension = html;

You need to build the application again and deploy it. Now you can access your web application using your defined extension.

http://localhost:8080/test.html

No comments:

Post a Comment