<a4j:jsFunction get not called for gmap
y0da May 18, 2007 3:01 AMHi!
I tried to include google map with richfaces at my old myFaces Project (after the map worked at a demo project), but it doesnt work. Especially my javascript functions get not called.
main jsp (include jsp selectionSimpleAuswahl.jsp):
<%@ page session="true" contentType="text/html;charset=utf-8"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <html> <HEAD> <title>eMORIS - Selektion</title> <link rel="stylesheet" type="text/css" href="http://www.umweltbundesamt.at/fileadmin/site_tpl/styles.css" /> <link rel="stylesheet" type="text/css" href="../../css/eMoris.css" /> <script type="text/javascript" src="../../script/block.js"></script> <script type="text/javascript" src="../../script/default.js"></script> <script type="text/javascript"> function createPoints(data) { for (var i = 0; data.length; i++) { var point = new GLatLng(data.lat, data.lng); map.addOverlay(createMarkerWithIdentifier(point, data.desc)); } } function createMarkerWithIdentifier(point, desc) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(desc); }); return marker; } </script> </HEAD> <body> <f:view> <h:form id="selMainForm" onsubmit="if (BlockSubmits()) return false;"> <f:loadBundle basename="bundles.labels" var="labels" /> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr class="firstrow"> <td width="100%" valign="top" colspan="2"> <table width="100%"> <tr> <td> <%@include file="selectionNav.jsp"%> </td> <td align="right"> <h:outputText styleClass="datainfo" value="#{labels.datenbank}: #{SessionUser.datenBank} - #{labels.userid}: #{SessionUser.user} (#{SessionUser.morisUser.rolle})" /> <h:outputText styleClass="datainfo" value="#{labels.sessionId}: #{SessionUser.sessionId}" /> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="content"> <%@include file="../common/logo.jsp" %> </td> </tr> <tr> <td colspan="2"> <h:panelGroup styleClass="startinfo" rendered="#{!smh.selectionBtnSaveCopyDisabled}"> <h:outputText styleClass="contextInfo" id="aktuelleSelection" value="#{selDetailHandler.aktuelleSelection.kurz} - #{selDetailHandler.aktuelleSelection.name}" /> <h:outputLink value="#{QueryParmBean.actualPath}" onclick="alert('#{labels.bookmarkmeClick}');return false;"> <h:outputText value=" #{labels.bookmarkMe}" /> <f:param id="id" name="id" value="#{selDetailHandler.aktuelleSelection.id}" /> <f:param id="database" name="database" value="#{SessionUser.datenBank}" /> </h:outputLink> <f:verbatim> <br /> <br /> </f:verbatim> </h:panelGroup> </td> </tr> <tr> <td class="navrow" width="25%" valign="top"> <%@include file="selectionBaumListe.jsp"%> </td> <td width="75%" valign="top"> <h:outputText value="#{labels.selektion}:" /> <h:panelGroup rendered="#{SessionUser.simpleSelectionGrant.update || SessionUser.powerSelectionGrant.update}"> <h:commandButton id="SelNeu" value="#{labels.neu}" type="submit" actionListener="#{smh.createSelektion}" /> <h:commandButton id="SelSpeichern" value="#{labels.speichern}" type="submit" actionListener="#{smh.saveCurrentSelektion}" disabled="#{smh.selectionBtnSaveCopyDisabled}" /> <h:commandButton id="SelLoeschen" value="#{labels.loeschen}" type="submit" actionListener="#{smh.deleteCurrentSelektion}" disabled="#{smh.selectionBtnDeleteDisabled}" /> <h:commandButton id="SelKopieren" value="#{labels.kopieren}" type="submit" actionListener="#{smh.copyCurrentSelektion}" disabled="#{smh.selectionBtnSaveCopyDisabled}" rendered="#{smh.selectionBtnCopyRendered}" /> <h:commandButton id="SelAusfuehren" value="#{labels.ausfuehren}" type="submit" actionListener="#{smh.changeToModeSimpleExecute}" disabled="#{smh.selectionBtnCreateDisabled || siSeFormHandler.showInitialLoadError}" rendered="#{smh.selectionBtnCreateRendered}" /> <h:commandButton id="SelErstellen" value="#{labels.erstellen}" type="submit" actionListener="#{smh.changeToModeSimpleCreate}" disabled="#{smh.selectionBtnExecuteDisabled || siSeFormHandler.showInitialLoadError}" rendered="#{smh.selectionBtnExecuteRendered}" /> <h:message for="SelKopieren" styleClass="fehlermeldung" /> </h:panelGroup> <h:outputLink styleClass="help" value="#{helpHandler.selektion}" target="_blank"> <h:outputText value="#{labels.hilfe}" /> </h:outputLink> <f:verbatim> <br /> <br /> </f:verbatim> <t:panelTabbedPane width="100%" id="TabbedPane" selectedIndex="#{SelectedTab.selected}" binding="#{smh.tabbedPane}"> <t:tabChangeListener type="org.uba.gegenstandsbereich.emoris.handler.SelectionTabbedHandler" /> <t:panelTab id="tabDetail" label="#{labels.detail}"> <%-- generates two tags with same id: div id="selMainForm:tabDetail" span id="selMainForm:tabDetail" --%> <%@include file="selectionDetail.jsp"%> </t:panelTab> <t:panelTab id="tabAuswahl" label="#{labels.auswahlschritte}" rendered="#{smh.selectionRendered}"> <%@include file="selectionAuswahl.jsp"%> </t:panelTab> <t:panelTab id="tabSimpleAuswahl" label="#{labels.auswahl}" rendered="#{smh.simpleSelectionExecRendered}"> <%@include file="selectionSimpleAuswahl.jsp"%> </t:panelTab> <t:panelTab id="tabErgebnis" label="#{labels.ergebnis}" rendered="#{smh.joinRendered || smh.selectionRendered || smh.simpleSelectionExecRendered}"> <%@include file="selectionErgebnis.jsp"%> </t:panelTab> <t:panelTab id="tabBeziehungen" label="#{labels.beziehungen}" rendered="#{smh.joinRendered || smh.selectionRendered}"> <%@include file="beziehungen.jsp"%> </t:panelTab> <t:panelTab id="tabZeitspannen" label="#{labels.zeitspannen}" rendered="#{smh.joinRendered || smh.selectionRendered}"> <%@include file="zeitspannen.jsp"%> </t:panelTab> <t:panelTab id="tabJoins" label="#{labels.joins}" rendered="#{smh.joinRendered}"> <%@include file="joins.jsp"%> </t:panelTab> <t:panelTab id="tabPivot" label="#{labels.pivot}" rendered="#{smh.joinRendered || smh.selectionRendered}"> <%@include file="pivot.jsp"%> </t:panelTab> <t:panelTab id="tabSuchformular" label="#{labels.suchformular}" rendered="#{smh.simpleSelectionCreateRendered}"> <%@include file="selectionSimpleSuchformular.jsp"%> </t:panelTab> <t:panelTab id="tabRechte" label="#{labels.rechte}" rendered="#{smh.simpleSelectionCreateRendered}"> <%@include file="selectionSimpleRechte.jsp"%> </t:panelTab> <t:panelTab id="tabBerichte" label="#{labels.berichte}" rendered="#{smh.simpleSelectionCreateRendered}"> <%@include file="selectionSimpleBerichte.jsp"%> </t:panelTab> <t:panelTab id="tabGis" label="#{labels.gis}" rendered="#{smh.joinRendered || smh.selectionRendered}"> <%@include file="gis.jsp"%> </t:panelTab> </t:panelTabbedPane> <h:message for="SelSpeichern" styleClass="fehlermeldung" /> <h:message for="SelAusfuehren" styleClass="fehlermeldung" /> <h:message for="tabSuchformular" styleClass="fehlermeldung" /> <h:message for="changedSave" styleClass="fehlermeldung" /> </td> </tr> </table> <h:panelGroup styleClass="dialog" rendered="#{siSeFormHandler.showInitialLoadError}"> <h:outputText value="#{labels.preSelectionNotAvailable}" /> </h:panelGroup> <h:panelGroup styleClass="dialog" rendered="#{smh.updateQuestionRendered}"> <h:outputText value="#{labels.aenderungenAktuelleSelektionAendern}" /> <f:verbatim> <br /> <br /> </f:verbatim> <h:panelGrid columns="3"> <h:commandButton id="changedSave" value="#{labels.ja}" type="submit" actionListener="#{smh.saveCurrentSelektion}" /> <h:commandButton value="#{labels.nein}" type="submit" actionListener="#{smh.restoreCurrentSelektion}" /> <h:commandButton value="#{labels.abbrechen}" type="submit" actionListener="#{smh.backCurrentSelektion}" /> </h:panelGrid> </h:panelGroup> </h:form> </f:view> </body> </html>
jsp selectionSimpleAuswahl (which include googleMap.jsp!!):
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <%@ taglib uri="/WEB-INF/pcd.tld" prefix="pcd"%> <f:subview id="subSelectionSimpleAuswahl"> <h:panelGrid columns="4" columnClasses="width60,"> <h:outputText value="#{labels.simpleData}:" /> <h:selectOneMenu value="#{siSeExecuteHandler.selected}" onchange="return DoPostBack('selMainForm');" styleClass="menuSiseExecuteTab" valueChangeListener="#{siSeExecuteHandler.processSelectionChanged}"> <f:selectItems value="#{siSeExecuteHandler.possibles}" /> </h:selectOneMenu> <h:commandButton value="#{labels.reset}" styleClass="width120" actionListener="#{siSeModuleHandler.doResetSiseSessionData}" /> <h:panelGroup style="font-size:8pt;font-style:italic;"> <h:outputText value="#{labels.leftParenthesis}" /> <h:outputText value="#{labels.currentResultCount}: " /> <h:outputText value="#{siSeExecuteHandler.resultCount}" /> <h:outputText value="#{labels.rightParenthesis}" /> </h:panelGroup> </h:panelGrid> <h:panelGroup rendered="#{siSeExecuteHandler.moduleRendered}"> <%@include file="module.jsp"%> </h:panelGroup> <h:panelGroup rendered="#{siSeExecuteHandler.module2Rendered}"> <%@include file="module2.jsp"%> </h:panelGroup> <h:panelGroup rendered="#{siSeExecuteHandler.valueRendered}"> <%@include file="value.jsp"%> </h:panelGroup> <h:panelGroup rendered="#{siSeExecuteHandler.value2Rendered}"> <%@include file="value2.jsp"%> </h:panelGroup> <h:panelGroup rendered="#{siSeExecuteHandler.geoRendered}"> <%@include file="googleMap.jsp"%> <!-- orig. map -> geo.jsp --> </h:panelGroup> <h:panelGroup rendered="#{siSeExecuteHandler.freeMetricalRendered}"> <%@include file="freeMetrical.jsp"%> </h:panelGroup> </f:subview>
googleMap.jsp (include map and not working a4j function):
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%> <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%> <f:subview id="googleMap"> <h:panelGrid columns="2"> <rich:gmap binding="#{gmBean.map}"/> </h:panelGrid> <h:form> <a4j:jsFunction name="initializePoints" data="#{gmBean.points}" oncomplete="createPoints(data)"> </a4j:jsFunction> </h:form> </f:subview>
The jsFunction get never called and so I got no points on the map.
web.xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <context-param> <description> State saving method: "client" or "server" (= default) See JSF Specification 2.5.2 if there is really no need of client side state saving, do not change this value server side state saving has the advantage of context-incompleteness and therefore its performance is much more better </description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <description> This parameter tells MyFaces if javascript code should be allowed in the rendered HTML output. If javascript is allowed, command_link anchors will have javascript code that submits the corresponding form. If javascript is not allowed, the state saving info and nested parameters will be added as url parameters. Default: "true" </description> <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name> <param-value>true</param-value> </context-param> <context-param> <description> This parameter tells MyFaces if javascript code should be allowed in the rendered HTML output. If javascript is allowed, command_link anchors will have javascript code that submits the corresponding form. If javascript is not allowed, the state saving info and nested parameters will be added as url parameters. Default: "false" Setting this param to true should be combined with STATE_SAVING_METHOD "server" for best results. This is an EXPERIMENTAL feature. You also have to enable the detector filter/filter mapping below to get JavaScript detection working. </description> <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name> <param-value>false</param-value> </context-param> <context-param> <description> If true, rendered HTML code will be formatted, so that it is "human readable". i.e. additional line separators and whitespace will be written, that do not influence the HTML code. Default: "true" </description> <param-name>org.apache.myfaces.PRETTY_HTML</param-name> <param-value>true</param-value> </context-param> <context-param> <description> If true, a javascript function will be rendered that is able to restore the former vertical scroll on every request. Convenient feature if you have pages with long lists and you do not want the browser page to always jump to the top if you trigger a link or button action that stays on the same page. Default: "false" </description> <param-name>org.apache.myfaces.AUTO_SCROLL</param-name> <param-value>true</param-value> </context-param> <!-- configure the emoris-specific command-delegate here --> <context-param> <param-name>command-delegate</param-name> <param-value>at.umweltbundesamt.spatial.emoris.command.EmorisCommandDelegate</param-value> </context-param> <context-param> <description> Set this flag to true if you want the JSF Reference Implementation to verify that all of the application objects you have configured (components, converters, renderers, and validators) can be successfully created. Default value is false. </description> <param-name>com.sun.faces.verifyObjects</param-name> <param-value>false</param-value> </context-param> <!-- configuration of the web-context relative WMC-document, which will be taken as the basic map-provider --> <context-param> <param-name>wmcdocument</param-name> <param-value>/WEB-INF/conf/wmc_spc_base.xml</param-value> </context-param> <!-- some performance tweaks to speed up tomcat up to 10 percent by handling sessions in a different way --> <context-param> <param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name> <param-value>false</param-value> </context-param> <context-param> <description> only applicable if state saving method is "server". defines the amount of the latest views which are stored in seession. </description> <param-name>org.apache.myfaces.NUMBER_OF_VIEW_IN_SESSION</param-name> <param-value>20</param-value><!-- default: 20 --> </context-param> <!-- Extensions Filter --> <filter> <filter-name>extensionsFilter</filter-name> <filter-class> <!-- org.apache.myfaces.component.html.util.ExtensionsFilter --> org.apache.myfaces.webapp.filter.ExtensionsFilter </filter-class> <init-param> <description> Set the size limit for uploaded files. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description> <param-name>uploadMaxFileSize</param-name> <param-value>100m</param-value> </init-param> <init-param> <description> Set the threshold size - files below this limit are stored in memory, files above this limit are stored on disk. Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB </description> <param-name>uploadThresholdSize</param-name> <param-value>100k</param-value> </init-param> <!-- <init-param> <param-name>uploadRepositoryPath</param-name> <param-value>/temp</param-value> <description>Set the path where the intermediary files will be stored. </description> </init-param>--> </filter> <filter> <filter-name>connectionFilter</filter-name> <filter-class>org.uba.gegenstandsbereich.emoris.handler.view.ConnectionFilter</filter-class> </filter> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>*.jsf</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>/faces/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>/faces/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>extensionsFilter</filter-name> <url-pattern>/jsp/selektion/faces/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>connectionFilter</filter-name> <url-pattern>*.jsf</url-pattern> </filter-mapping> <!-- Listener, that does all the startup work (configuration, init). --> <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> <listener> <listener-class> org.uba.gegenstandsbereich.emoris.handler.MorisContextListener </listener-class> </listener> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet> <servlet-name>ControllerServlet</servlet-name> <servlet-class> org.uba.gegenstandsbereich.emoris.handler.FrontController </servlet-class> <load-on-startup>0</load-on-startup> </servlet> <servlet> <servlet-name>WfsServlet</servlet-name> <servlet-class>at.umweltbundesamt.spatial.emoris.servlet.WfsServlet</servlet-class> <!-- path for generated geometry-layers: default '/spc_tmp/' --> <init-param> <param-name>path</param-name> <param-value>/temp</param-value> </init-param> <!-- cleanupInterval for garbage-collection thread: default '15' (scale=minutes) --> <init-param> <param-name>cleanupInterval</param-name> <param-value>20</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Faces Servlet Mapping --> <!-- virtual path mapping --> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <!-- extension mapping --> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.source</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ControllerServlet</servlet-name> <url-pattern>/Controller</url-pattern> </servlet-mapping> <!-- precompile include --> <servlet-mapping> <servlet-name>WfsServlet</servlet-name> <url-pattern>/wfs/*</url-pattern> </servlet-mapping> <!-- Welcome files --> <welcome-file-list> <welcome-file>index.jsf</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>index.html</welcome-file> </welcome-file-list> <error-page> <exception-type>java.lang.Exception</exception-type> <location>/jsp/common/errorpage.jsp</location> </error-page> <resource-ref> <description>emoris_test Oracle Datasource</description> <res-ref-name>emoris_test</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <description>moris_ntest Oracle Datasource</description> <res-ref-name>moris_ntest</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <description>moris10g Oracle Datasource</description> <res-ref-name>moris10g</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <description>moris10g Oracle Datasource</description> <res-ref-name>moris10gLocal</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <description>moris10g Oracle Datasource</description> <res-ref-name>moris10gExtern2</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <description>moris10g Oracle Datasource</description> <res-ref-name>moris10gEcht</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <resource-ref> <description>Default DB Connection</description> <res-ref-name>defaultDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <!-- hinzugefügt für google Map --> <context-param> <param-name>org.ajax4jsf.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> </web-app>
best regards