jsf 2 - How to execute JavaScript after page load? -



jsf 2 - How to execute JavaScript after page load? -

i execute javascript function after page loaded. @ moment have commandbutton , works fine. more comfortable if user not supposed nail button.

i have tried f:event, not have listener, have javascript function. body onload not work me utilize high level components.

<f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:pm="http://primefaces.org/mobile" contenttype="text/html"> <ui:composition template="/resources/master.xhtml"> <ui:define name="content"> <pm:content> <h:inputhidden id="address" value="#{pathfinderbean.address}" /> <div id="map" style="width: 100%; height: 285px;"></div> <p:commandbutton type="button" value="route" onclick="pathfinder.findandgo()"/> <div id="route"></div> </pm:content> </ui:define> </ui:composition>

the javascript function pathfinder.findandgo defined in master.xhtml

use jquery follows:

<script> jquery(document).ready(function() { pathfinder.findandgo(); }); </script>

update:

it has within <ui:define name="content">.

javascript jsf-2 primefaces onload

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -