简体   繁体   中英

Forward from struts1.2 to html resource

I want to make forward from mine struts 1.2 application to the ususal html file. But always have error 404 The requested resource (/gui-web/static/index.html) is not available .

I have an index.html time in directory static which is available by direct access. But I cannot get it from struts.

Here is my struts-config.xml:

 <action
 path="/static/overview"
 type="org.apache.struts.actions.ForwardAction"
 parameter="/static/index.html"/>

I am migrating to Angular app on client side, that is why I need to specify those routes on the server.

OK I have found the way. I used the <jsp-file> property in servlet declaration and it works fine. Here is the snippet from web.xml :

<servlet>
    <servlet-name>angular</servlet-name>
    <jsp-file>/static/index.html</jsp-file>
</servlet>
<servlet-mapping>
    <servlet-name>angular</servlet-name>
    <url-pattern>/static/overview</url-pattern>
</servlet-mapping>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM