How to return an HTML page from struts.xml yourself, without resorting to action?

If the request is made to an HTML page, how to return it directly from struts.xml without participating in the action?

+4
source share
1 answer

Create an action that has a result in struts.xml but does not have class , i.e.

 <package name="default" extends="struts-default"> <action name="index"> <result name="myPage">/path/to/page.html</result> </action> 

You can also create a global result that can be found from any action, for example,

 <global-results> <result name="myPage">/path/to/page.html</result> </global-results> <action name="index"/> 

You can create an interceptor that returns the result when intercepting and acting. These are important configuration items that call the dispatcher to redirect to the requested page.

+3
source

Source: https://habr.com/ru/post/1493104/


All Articles