如何将远程JS文件(如Google Maps API url或任何远程JS文件路径)引用到JSF 2.0页面?
我理解的是这段代码
<h:head></h:head>
<h:body>
<h1>JSF 2 outputScript example</h1>
<h:outputScript library="js" name="example.js" />
</h:body>
将呈现如下
<head></head>
<body>
<h1>JSF 2 outputScript example</h1>
<script type="text/javascript"
src="/JavaServerFaces/faces/javax.faces.resource/example.js?ln=js">
</script>
</body>
我怎么能引用外部JS文件,如果它默认指向src="/JavaServerFaces/faces/javax.faces.resource/
?
按照正常的html方式包含它们,例如:
<h:head>
<script src="http://maps.googleapis.com/maps/api/js?libraries=places..."
type="text/javascript">
</script>
</h:head>
您可以在facet中混合html标记和JSF标记。