问一个Ajax控制SVG的问题
环境部署正常,SVG插件也安装了,这是一个从IBM下载的例子,可就是运行不正常(欧尔正常)
weblogic 6.1
原始JSP文件如下:
************************************************************************
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<script type='text/javascript' src='/dwr/interface/MeterRemote.js'></script>
<script type='text/javascript' src='/dwr/engine.js'></script>
<script type='text/javascript' src='/dwr/util.js'></script>
<base href="<%=basePath%>">
<title>Ajax 实时监控</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="ajax test page">
<script >
var last_degree=0,curr_degree=270;
function getValue()
{
MeterRemote.getDegree(loadinfo);
}
function loadinfo(data)
{
DWRUtil.setValue("reply1", data);
curr_degree=data;
var svgDocument = window.sample2.getSVGDocument();
chart=svgDocument.getElementById("line2");
chart.setAttribute( "from", last_degree+",250,250");
chart.setAttribute( "to", curr_degree+",250,250");
chart.beginElement();
last_degree=curr_degree;
}
function aaa()
{
var svgDocument = window.sample2.getSVGDocument();
chart=svgDocument.getElementById("line2");
//chartext.setAttribute( "x", "0");
chart.beginElement();
}
function run()
{
window.setTimeout("run()", 5000);
getValue();
}
</script>
</head>
<body >
<button onclick="run()">start</button>
<span id='reply1' class='reply'></span><br><br>
<embed id="sample2" src="MeterChart.svg" width="625.5" height="393" type="image/svg+xml">
</body>
</html>
********************************************************************************
以上代码运行后,SVG加载不了,后将第三行
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
屏蔽,并将<base href="<%=basePath%>"> 写死
页面提示“拒绝访问” 请教高人