我正在进行实时车辆跟踪项目。
我每隔6秒就会得到一个车辆位置,每次我将lat和long存储在静态变量中。
我希望在使用ajax更改位置后显示车辆在Google地图上移动 我编写了代码:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://code.google.com/p/gmaps4jsf/" prefix="m"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META HTTP-EQUIV=" " CONTENT="6">
<title>Insert title here</title>
<script
src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAtRLgopSfFn_inKV4Mb4dwRQrh986W3YN5ROngdOVRv-81htxfBSHsTcVUm4HRkCt9bSp5mP_3_snrw"
type="text/javascript">
</script>
</head>
<body>
<f:view>
<h:form id="aaaa">
<h:panelGrid columns="2">
<m:map id="mp" width="500px" height="500px" latitude=" #{mp3.lat} "
longitude=" #{mp3.lon}" zoom="15">
<m:mapControl name="GMapTypeControl" />
<m:mapControl name="GLargeMapControl"
position="G_ANCHOR_BOTTOM_RIGHT" />
<m:marker id="m" latitude=" #{mp3.lat} " longitude=" #{mp3.lon}">
<m:htmlInformationWindow htmlText="Start<br> " />
<a4j:support event="onchange" action=" " reRender="m"></a4j:support>
</m:marker>
</m:map>
</h:panelGrid>
<h:commandButton value="Start" action="#{mp3.meth}" />
<h:commandButton value="Path Map" action="pathmp" />
</h:form>
</f:view>
</body>
</html>
我的问题是如何使用ajax a4j在谷歌地图上移动车辆标记而不重新加载所有页面?
我使用的技术是 - jsf由于