angular - Struts 1.3项目中的Angular11 html找不到资源
问题描述
我想将一个新的 Angular 11 项目集成到一个旧的、遗留的 Struts 1.3 项目中。我将 Angular 放在一个文件夹中,并进行了设置,以便将构建文件与其余 Struts 文件一起package.json
放入目录中:/webapp
+--src
| +-- java
| +-- ui (Angular files)
| +-- webapp (Struts)
| | +-- angular build files
| | +--web-inf (Struts public files)
我使用 JSP 页面上的操作链接链接到我的 Angular 静态 html:
<html:link action="ConfigurationDataSetup.do">
我struts-config.xml
有一个匹配的动作:
<action
path="/ConfigurationDataSetup"
type="org.apache.struts.actions.ForwardAction"
name="ConfigurationDataSetup"
parameter="/angular/configurationDataSetup.html">
</action>
当我在本地 WebLogic 服务器上为项目提供服务时,我收到 404 错误,表明项目找不到我的静态角度资源的其余部分。我认为是因为出于某种原因,它正在项目的根目录中寻找它们:
GET http://localhost:7001/styles.css net::ERR_ABORTED 404 (Not Found)
GET http://localhost:7001/runtime.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:7001/main.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:7001/polyfills.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:7001/vendor.js net::ERR_ABORTED 404 (Not Found)
我通过localhost:7001/ScoreReportsWorkbench
.
这是为我的登录页面提供服务的 URL。
任何想法为什么我无法访问这些文件?
解决方案
我的问题是我的tiles-defs.xml 中没有定义。我创建了一个定义:
<definition name="configurationDataSetup.layout" extends="base.layout">
<put name="pageName" value="ConfigurationDataSetup" />
<put name="body" value="/angular/configurationDataSetup.html" />
</definition>
这在我的struts-config.xml
:
<action forward="configurationDataSetup.layout" path="/ConfigurationDataSetup" />
我还必须在我的base.layout
文件中包含脚本和样式引用,以便 webapp 可以加载这些资源,因为 tile 定义只导入 HTML。
推荐阅读
- html - 离子cordova popover组件中的img不显示
- kotlin - 如何将人分组?
- asp.net-core - 视图中未显示 ASP .NET Core MVC 模型
- c# - 将会议请求发送到 Exchange Online 会议室邮箱
- postgresql - PostgreSQL 慢查询
- java - 如何使用 javac 注释处理器在 webapp 中生成 xhtml 文件
- java - 生产者-消费者。消费者等待所有生产者完成,毒丸
- nginx - 使用 Nginx 和 SNI 时未知主机的后备配置?
- html - 在移动设备上仅针对某些容器而不是整个页面水平滚动
- time-series - adf 测试结果明显错误并与 kpss 测试对比