Question

I'm trying to add Google Maps onto my JSPs by using the Googlemaps taglib.

I've added this into my maven pom

    <dependency>
        <groupId>com.lamatek</groupId>
        <artifactId>googlemaps</artifactId>
        <version>0.98c</version>
        <scope>provided<>/scope
    </dependency>

This then included the googlemaps-0.98c library under my project libraries in NetBeans, I right clicked and selected Manually install artifact and located the googlemaps.jar file I had downloaded.

I've then added this into my taglibs file

<%@taglib prefix="googlemaps" uri="/WEB-INF/googlemaps" %>

And have then included this where I actually want to show a map on my jsp

    <googlemaps:map id="map" width="250" height="300" version="2" type="STREET"
                    zoom="12">
        <googlemaps:key domain="localhost" key="xxxx"/>
        <googlemaps:point id="point1" address="74 Connors Lane" city="Elkton"
                          state="MD" zipcode="21921" country="US"/>
        <googlemaps:marker id="marker1" point="point1"/>
    </googlemaps:map>

But when I load up my application, I get the following error.

org.apache.jasper.JasperException: /jsp/dashboard.jsp(1,1) /jsp/common/taglibs.jsp(6,56) PWC6117: File "/WEB-INF/googlemaps" not found

root cause

org.apache.jasper.JasperException: /jsp/common/taglibs.jsp(6,56) PWC6117: File "/WEB-INF/googlemaps" not found

Have I missed something simple? I'm unable to spot what I've done wrong so far..

Was it helpful?

Solution

Generally when you do this:

<%@taglib prefix="googlemaps" uri="/WEB-INF/googlemaps" %>

You are basically trying to say "the folder /WEB-INF/googlemaps has a bunch of .tag files for use" - which you don't.

Just browsing the documentation confirms this - it says you should be using this (note the usage of the tld extension):

<%@ taglib uri="/WEB-INF/googlemaps.tld" prefix="googlemaps" %> 

Source: http://www.lamatek.com/GoogleMaps/documentation.jsp#installation

OTHER TIPS

If you set scope to provided in your pom it is not included in the war file and the taglib will not be found. You should change the scope to compile or runtime.

The URI should not be /WEB-INF/googlemaps.tld. It should match the value in the <uri> tag in the googlemaps.tld.

Open up the googlemaps.jar, find the googlemaps.tld, and find the <uri> tag. That's the URI you need.

UPDATE:

I just downloaded the googlemaps.jar. I'm incorrect; the URI is indeed <uri>/WEB-INF/googlemaps.tld</uri>.

That suggests that you have to extract the googlemaps.tld file and put it under /WEB-INF in your web context, be it WAR or exploded.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top