4

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

Roman C
  • 49,761
  • 33
  • 66
  • 176
lupchiazoem
  • 8,026
  • 6
  • 36
  • 42

1 Answers1

3

Create an action that has a result in the struts.xml but doesn't have a class, i.e.

<package name="default" extends="struts-default">

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

You could also create a global result, that could be found from any action, i.e

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

<action name="index"/> 

You could create an interceptor that returns a result while intercepting and action. These are essential elements of the configuration that invoke a dispatcher to forward to requested page.

Roman C
  • 49,761
  • 33
  • 66
  • 176