Mark the current location:
ExampleCode:
VaRMarker =NewBmap. Marker (point); map. addoverlay (Marker );
Show footprints on a map:
To display the footprint list, you must use the "add line" method in Baidu map API.
The reference code provided in the API documentation is:
VaRPolyline =NewBmap. polyline ([NewBmap. Point (116.399, 39.910),NewBmap. Point (116.405, 39.920)], {Strokecolor:& Quot; blue & quot;, strokeweight: 6, strokeopacity: 0.5}); Map. addoverlay (polyline );
We can see that polyline is the key to display discount.
So how to write this Polyline in JSP?
You can use el expressions.
Look at a strange piece of code that the compiler reports an error:
<SCRIPT type = "text/JavaScript"> VaR Map = New Bmap. Map ("position" ); VaR Point = New Bmap. Point ($ {Currentlocation. longpolling},$ {Currentlocation. Latitude}); Map. centerandzoom (point, 18 ); VaR Polyline = New Bmap. polyline ([ <C: foreach Items = "$ {list}" Var = "Bean">NewBmap. Point ($ {Bean. longpolling},$ {Bean. Latitude}), </C: foreach> ], {Strokecolor: & Quot; blue & quot;, strokeweight: 6, strokeopacity: 0.5 }); Map. addoverlay (polyline ); </SCRIPT>
We can see that the El expression is actually embedded in the JS Code. This will cause the compiler to report an error. However, this code is valid.
Because the El expression will be organized before JS can run.
If someone else is quoted
"ElThe expression is inServerExecuted, which is sent to the client after the server completes execution,JSYesClientExecuted,El was executed before Js."
Displays the effect of the displayed path.