문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top