如果我注释掉了脚本标签,页面就会在没有错误的情况下加载。我认为这是因为javascript不符合XHTML吗?如果我包括我自己的script.js,它也不会导致错误。
<composite:interface>
<composite:attribute name="managedBean" />
</composite:interface>
<composite:implementation xmlns:corecommon="http://java.sun.com/jsf/composite/components/core/common">
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<h2>Google Charts with JSF Test</h2>
<gc:googleChart divID="chartDiv" model="#{managedBean.chartModel}" height="500px" width="100%"/>
</composite:implementation>发布于 2014-04-06 23:44:40
我得到了一个错误:"NetworkError: 405方法不允许- https://maps.googleapis.com/maps/api/js?sensor=true“
我认为加载页面的事件会干扰google图表库。
这个问题之所以出现,是因为我使用标记通过AJAX加载页面的图表。将其更改为标记解决了问题。
这篇文章可能解决ajax加载问题:Load a Google Chart from an asynchronous AJAX response
https://stackoverflow.com/questions/22853927
复制相似问题