简体   繁体   English

从struts1.2转发到html资源

[英]Forward from struts1.2 to html resource

I want to make forward from mine struts 1.2 application to the ususal html file. 我想从我的struts 1.2应用程序发展到常用的html文件。 But always have error 404 The requested resource (/gui-web/static/index.html) is not available . 但始终会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. 我在static目录中有一个index.html时间,可以直接访问。 But I cannot get it from struts. 但是我无法从支撑架上获得它。

Here is my struts-config.xml: 这是我的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. 我正在迁移到客户端的Angular应用程序,这就是为什么我需要在服务器上指定这些路由。

OK I have found the way. 好,我找到了路。 I used the <jsp-file> property in servlet declaration and it works fine. 我在servlet声明中使用了<jsp-file>属性,它可以正常工作。 Here is the snippet from web.xml : 这是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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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