如何使用Tomcat + JSF 2部署OpenLayers [英] How to deploy OpenLayers with Tomcat + JSF 2
问题描述
我正在尝试在tomcat上部署我的JSF 2.0应用程序中的OpenLayers。
I'm trying to get OpenLayers deployed in my JSF 2.0 App on tomcat.
到目前为止,我所做的是复制 openLayers .js
到网络应用程序的资源
目录(我有其他JS在那里工作成功)和主题
和 img
目录到相同的资源
目录。
So far, What I did was to copy openLayers.js
to the resources
directory of the web app (I have other JS working from there successfully) and the theme
and img
directories in to the same resources
directory.
接下来,我从我的 xhtml
文件中包含 openLayers.js
,如下所示:
Next, I included openLayers.js
from my xhtml
file as follows:
<h:outputScript library="js" name="openLayers.js" />
当我尝试使用 OpenLayers
我得到 Javascript
控制台上的这些错误:
When I try to use OpenLayers
I get these errors on the Javascript
console:
BaseTypes.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes.js 404 (Not Found)
Class.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes/Class.js 404 (Not Found)
Util.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/Util.js 404 (Not Found)
Element.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes/Element.js 404 (Not Found)
Bounds.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes/Bounds.js 404 (Not Found)
LonLat.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes/LonLat.js 404 (Not Found)
Pixel.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes/Pixel.js 404 (Not Found)
Size.jsGET https://ben.serveraddress.com:8443/MDPortal/lib/OpenLayers/BaseTypes/Size.js 404 (Not Found)
推荐答案
尝试
<h:outputScript library="js" name="http://openlayers.org/api/OpenLayers.js" />
或者确保你复制 /build/OpenLayers.js
到 / lib
。
哦,别忘了还要复制 / theme
和 / img
目录。
这篇关于如何使用Tomcat + JSF 2部署OpenLayers的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!