我正在CQ中实施amcharts。我通过调用我暂时托管在本地glassfish服务器中的servlet来获取数据。以下是我的amchart组件jsp的代码片段。
<%@include file="/libs/foundation/global.jsp"%><%
%><%@page session="false" %><%
%><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test amcharts generation</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id="container">
<div id="singlesection" class="norm" >
<div class="norm">
<script type="text/javascript" src="/apps/geometrixx/components/amchart/am/swfobject.js"></script>
<div id="flashcontent"><strong>You need to upgrade your Flash Player</strong></div>
<div id="result"></div>
<script type="text/javascript">
// <![CDATA[
var so = new SWFObject("/apps/geometrixx/components/amchart/am/amstock.swf", "amstock", "600", "400", "8", "#FFFFFF");
var uri = "http://localhost:8080/Charts/apps/CreateXMLFileServlet?r="+Math.random()+"&fc=03";
so.addVariable("settings_file", encodeURIComponent(uri));
so.addVariable("chart_id", "amstock");
so.addVariable("key", "106-d0564444fe0a5ce6839d84f70655375c");
so.write("flashcontent");
// ]]>
</script>
</div>
</div>
</div>
</body>
问题是,servlet没有被调用。如果我直接从浏览器尝试servlet url,我会得到响应。请在这里建议我做错了什么。谢谢。
答案 0 :(得分:0)
听起来您可能遇到跨域安全限制。如果您正在加载页面,它具有来自一个域的SWF代码,但随后调用另一个域来获取数据,则可能会遇到安全限制。你能列出这两个部分的完整域名吗?
查看http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html,了解如何解决此问题。