Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7976261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:52:22+00:00 2026-06-04T08:52:22+00:00

I’m working with JSF2 and I want to display a map with the object

  • 0

I’m working with JSF2 and I want to display a map with the object gmap. As I saw, gmap object doesn’t exist anymore with richfaces 4.x, so I tried to import the gmap4jsf.jar to render my map…

To have an exemple I took a part of my code from the Richfaces demo here : Richfaces live demo

The map is displayed well, but if I want to control it (change the type, zoom,…) with the jsf elements from the rich:panel, I get an error in Firebug : “map is undefined”…
Can somebody help me to find out the problem please because I didn’t find the answer in other thread…
Here is my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:m="http://code.google.com/p/gmaps4jsf/"><h:head><title>JSF 2.0: Ajax Support</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=myPersonnalKeyIsWrittenHere"></script>
<script type="text/javascript"
    src="http://code.jquery.com/jquery-1.7.1.js"></script>

<style>.optionList {height: 30px;}</style></h:head><h:body>
<div id="container">
    <ui:include src="tpl/menu.xhtml" />
    <h1>Gmap4Jsf</h1>
    <div align="center">

        <f:view contentType="text/html">
            <h:panelGrid columns="2">
                <h:form id="mapform" prependId="false">
                    <m:map var="map" mapVar="map" gmapKey="#{gmapBean.gmapkey}" id="map" /> 
                </h:form>
                <h:panelGroup>
                    <h:form>

                        <rich:tabPanel switchType="ajax" width="350" height="400">
                            <rich:tab label="Using Google Map API">
                                <h:panelGrid columns="2" columnClasses="optionList">
                                    <h:outputText value="Controls:" />
                                    <h:panelGroup>
                                        <a href="javascript: void 0" onclick="map.hideControls()">Hide</a>
                                        <a href="javascript: void 0" onclick="map.showControls()">Show</a>
                                        <br />
                                    </h:panelGroup>

                                    <h:outputText value="Zoom:" />
                                    <rich:inputNumberSlider id="zoom" showInput="false"
                                        minValue="1" maxValue="18" value="#{gmapBean.zoom}"
                                        onchange="map.setZoom(this.value)" />


                                    <h:outputText value="Map Type:" />
                                    <h:panelGroup>
                                        <a href="javascript: void 0"
                                            onclick="map.setMapType(G_NORMAL_MAP)">Normal</a>
                                        <a href="javascript: void 0"
                                            onclick="map.setMapType(G_SATELLITE_MAP)">Satellite</a>
                                        <a href="javascript: void 0"
                                            onclick="map.setMapType(G_HYBRID_MAP)">Hybrid</a>
                                        <br />
                                    </h:panelGroup>

                                </h:panelGrid>
                            </rich:tab>

                            <rich:tab label="Using Ajax with JSON">
                                <rich:dataGrid var="place" value="#{gmapBean.point}"
                                    columns="2">
                                    <h:graphicImage onclick="showPlace('#{place.id}')"
                                        style="cursor:pointer" value="resource://#{place.pic}" />
                                </rich:dataGrid>
                            </rich:tab>
                        </rich:tabPanel>
                    </h:form>
                </h:panelGroup>
            </h:panelGrid>
        </f:view>
    </div>
</div>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:52:23+00:00Added an answer on June 4, 2026 at 8:52 am

    Ok I found it out…

    I had to define the name of the Javascript variable generated by JSF.
    So, I just added the attribut “jsVariable” to my gmap element.

    <m:map jsVariable="map" var="map" mapVar="map" gmapKey="#{gmapBean.gmapkey}" id="map" />
    

    Bye

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to parse a xhtml file and display in UITableView. what is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.