【问题标题】:Can't set proper path to app.js无法为 app.js 设置正确的路径
【发布时间】:2017-06-06 20:55:18
【问题描述】:

我正在使用 angularjs 用 Ja​​va 开发 webapp。我的问题是我在 app.js 和 app.css 文件上得到 404。

index.html 的路径

webapp/WEB-INF/app/pages/index.html

app.js 的路径

webapp/WEB-INF/app/js/app.js

app.css 的路径

webapp/WEB-INF/app/css/app.css

在html中连接css和脚本:

<link rel="stylesheet" type="text/css" href="/css/app.css" media="all" />
<script type="text/javascript" src="/js/app.js"></script>

正确的路径应该是什么?

【问题讨论】:

  • 这些都是静态资源,你有没有试过用类似的东西:
  • 用户 WebContent 添加 index.html 页面。在 webContent .ex 脚本中添加子文件夹是子文件夹。脚本下的 app.js。添加指向 index.html 页面的链接。

标签: java angularjs spring-mvc


【解决方案1】:

我已经找到了解决方案。我正在使用 lineman 和 lineman 在“生成”文件夹中创建真正的 index.html。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多