GoogleMaps JSP Taglibrary  

Google:maps
Documentation

[ Installation | TLD Docs & JavaDocs | Other Resources ]

Before beginning use of the Google Maps JSP Taglibrary you must:

  1. Read and agree to the Google Terms of Use.
  2. Sign up for an API Key.

Installation

Installation of the Google:maps JSP taglibrary couldn't be easier:

  1. Download the taglibrary googlemaps.jar file
    • If you're going to use marker clustering, you'll need to download the Clusterer javascript file.
    • If you plan to use WMS tiles with your Google Maps, you'll need to download either wms1.js or wms2.js script files (depending on the map versions you'll be using).
  2. Store the tag library in the /WEB-INF/lib directory of your website/application.

Next you'll need to make sure tag pooling is disabled on your servlet container. How this works depends on the specific container you're using. Below I have instructions on how to disable pooling on a Tomcat server and Resin based Servers:

Tomcat Servers

  1. Open the web.xml file located in the <%TOMCAT_HOME%>/conf directory of your server installation.
  2. Look for the section where the JSP servlet is mapped. It starts with:
            <servlet>
                <servlet-name>jsp</servlet-name>
    
  3. Look for a section called enablePooling. If it's defined it should look like this:
            <init-param>
                <param-name>enablePooling</param-name>
                <param-value>true</param-value>
            </init-param>
    
    If it's not defined, that okay.
  4. If you have a section already defined, change the <param-value> to false. If you do not have it defined, simply copy and paste this definition in the <init-param> section:
            <init-param>
                <param-name>enablePooling</param-name>
                <param-value>false</param-value>
            </init-param>
    
  5. Now you'll have to restart Tomcat.
Resin Based Servers
  1. Within the web.xml file for your application you'll need to include a <jsp> tag with the recycle-tags attribute set to false. For example:
    <web-app> 
      <jsp recycle-tags="false"/> 
    ... 
    </web-app> 
    
You will now need to restart your application in Resin or restart the server.

Now you're ready to go. To use the taglibrary in your JSP page all you need to do is:

  1. Include the following at the top of each page that will use the taglibrary:
    <%@ taglib uri="/WEB-INF/googlemaps.tld" prefix="googlemaps" %>

Now you're ready to include Google:map tags in your page. See our Examples Page for example JSP pages using the tag library.

TLD Documentation

TLD documentation is the most useful documentation for Google:maps. It shows all the available tags and the available parameters for each and what they do

TLD documentation was generated using the taglibrarydoc utility available from dev.java.net.

See the TLD Documentation

JavaDocs documentation is useful for developers generating dynamic Google Maps using the event processing capabilities of the GoogleMaps JSP Taglibrary. Users will not need to override methods or subclass classes, but they will need knowledge of how the tags work programmatically so they can add points, markers, overlays and event processors on the fly.

JavaDoc documentation was generated using the javadoc utility available from java.sun.com

See the JavaDoc Documentation

Other Resources

The Formatting Guide
Before you begin constructing your first Google:maps application it is highly recommended that you read and follow the instructions on the formatting guide. This will eliminate 99% of all the problems you'll encounter using the Google:maps tag library.

GoogleMaps DTD
This DTD is used to validate XML files when using XML to define map data.

The Examples
A map is worth a thousand words, each includes the functional map alongside with the JSP code that generates them.

JSP Technology
JSP technology overview and documentation from it's creator, Sun Microsystems™.

GoogleMaps™ API
GoogleMaps™ API documentation and overview.

Google-Maps-Api Groups
Discussion group related specifically to the GoogleMaps™ API.

The Mapki
A plethora of good information on the Google Maps API.

The Google Maps Blog
The official blog for the Google Maps API team.

Mike William's Google Maps Page
Mike has a ton of good information on the Google Maps API as well as a lot of tips and tricks. He has been invaluable in the creation of this taglibrary!

Google
Search for Google Maps technology:

Java JSP PHP ASP
Google™ and the GoogleMaps API are copyright of Google.