S
Stephen Lynch
I've come up against a problem. I'm using example 14 - Integrating
with JSTL on the <google:maps> JSP tag library page
(http://www.lamatek.com/GoogleMaps/example_14.jsp). The example uses
address information to locate the nodes on the map. This means that
strings are provided. However for my project I need to use coordinates
to locate nodes on the map. The requirement here is that the
coordinates must be of type double. How can I convert the value I'm
getting from the database to a double. Here is my jsp at the moment:
I'm getting a number format exception as the googlemapsoint tag is
expecting a double value for latitude and longitude. How can I convert
the type so this error will not occur? I've checked on the web and
found lots of stuff on formatting variables but I can't seem to get
anything to work.
Thanks in advance.
with JSTL on the <google:maps> JSP tag library page
(http://www.lamatek.com/GoogleMaps/example_14.jsp). The example uses
address information to locate the nodes on the map. This means that
strings are provided. However for my project I need to use coordinates
to locate nodes on the map. The requirement here is that the
coordinates must be of type double. How can I convert the value I'm
getting from the database to a double. Here is my jsp at the moment:
Code:
<%@ taglib uri="/WEB-INF/googlemaps.tld" prefix="googlemaps" %>
<html>
<head>
<googlemaps:map id="map" width="780" height="300" version="2"
type="STREET" zoom="14">
<googlemaps:key domain="localhost"
key="ABQIAAAAu5sL2M_5dsMWTq0HTkmaYRTwM0brOpm-All5BF6PoaKBxRWWERQCgis0__2wvxkL3DH1fVas9qmZdA"/>
<googlemaps:message>
<img src="/GoogleMaps/images/loading.gif"/> Please wait...
</googlemaps:message>
<sql:setDataSource var="myDataSrc"
url="jdbc:mysql://localhost:3306/test" driver="
com.mysql.jdbc.Driver"
user="root" password=""/>
<sql:query var="myCoordinates" dataSource="myDataSrc">
SELECT * FROM coordinates1
</sql:query>
<c:forEach var="node" items="${myCoordinates.rows}">
<googlemaps:point
id="point_${node.nodeId}"
center="${true}"
latitude="${node.lattitude}"
longitude="${node.longitude}"/>
<googlemaps:marker
id="marker_${ node.nodeId}"
point="point_${node.nodeId}"/>
</c:forEach>
</googlemaps:map>
<googlemaps:scripttag id="map"
scope="test.jsp"></googlemaps:scripttag>
<googlemaps:javascript id="map"
scope="test.jsp"></googlemaps:javascript>
</head>
<body>
<googlemaps:div id="map" scope="test.jsp"></googlemaps:div>
This should appear below the map.
<googlemaps:initialize id="map"
scope="test.jsp"></googlemaps:initialize>
</body>
</html>
I'm getting a number format exception as the googlemapsoint tag is
expecting a double value for latitude and longitude. How can I convert
the type so this error will not occur? I've checked on the web and
found lots of stuff on formatting variables but I can't seem to get
anything to work.
Thanks in advance.