This demo application will show you how to use google map web service for searching any location. First of all we need to create an Java Web Application with any name, let it be google_app here using Netbeans IDE. The code inside the index.jsp will be similar to this
Then we need to click on Services tab and it will look like the image below.
|
Then drag the getGoogleMap into index.jsp file. The page will contain the following code
<% try { RestResponse result = GoogleMapService.getGoogleMap(address, zoom, iframe); %> </body> GoogleMapService.getGoogleMap Method is the method responsible for getting the location in map. Method address – address string to generate map for. We need to change the above code to get loaction search functionality using google map web service. Before running the application we need the Google api key. After getting the api key ,set the key in Now the application is ready for searching the location.
|