访问Web应用程序的静态资源 [英] Accessing a web application's static resources
本文介绍了访问Web应用程序的静态资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚使用 Wicked 框架构建了一个非常简单的Java Web应用程序.该项目的当前布局是:
I've just built a very simple Java web application using the Wicked framework. The current layout of the project is:
src/
main/
java/
net/myapp/
Homepage.java
Homepage.html
reources/
scripts/
script.js
在Homepage.html
文件中,我正在尝试加载JavaScript文件:
In the Homepage.html
file I am trying to load the JavaScript file:
<script src="scripts/script.js"></script>
我部署了该应用程序,但浏览器找不到JavaScript文件.
I deployed the application, but the browser doesn't find the JavaScript file.
正在使用maven-war-plugin打包 WAR 文件.我查看了WAR文件,然后看到以下布局:
The WAR file is being packaged using the maven-war-plugin. I looked into the WAR file, and I see the following layout:
WEB-INF/
classes/
net/myapp/
Homepage.class
Homepage.html
scripts/
script.js
我做错了什么?我想念什么?
What am I doing wrong? What am I missing?
推荐答案
与网络相关的资源应放在src/main/webapp
The web-related resources should be placed in src/main/webapp
这篇关于访问Web应用程序的静态资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文