Could define a composition component for as below to support the javascript in JSF and use them in normal xhtml / jsf pages.
So we would have the flexibility of rendering and not rendering the Javascript in the pages with the JSF life-cycle.
Javascript.xhtml (below, replace "[" with "<")
[ui-composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"]
[c:choose]
[c:when test="#{not empty path}"]
[script type="text/javascriptt"
srcc="#{facesContext.externalContext.requestContextPath}
#{path}"]
[/script]
[/c:when]
[c:0therwise]
[script type="text/javascript"]
[ui:insert /]
[/script]
[/c:otherwise]
[/c:ch00se]
[/ui:composition]
In JSF/xhtml page, we could render javascript functions as below.
[h:form]
[yournameSpace:javascriptt]
Function hello(){ alert(‘hello…’); }
[/yournamespace:javascript]
[yournameSpace:javascript rendered=”#{condition}”]
Function hello1(){ alert(‘hello…’); }
[/yournamespace:javascript]
[/h:form]
So we have the flexibility to render/ not-render/ re-Render by AJAX.
Handling data between the JSF & Javascript will be easy
Showing posts with label JSF with Javascript. Show all posts
Showing posts with label JSF with Javascript. Show all posts
Monday, December 7, 2009
JSF with JavaScript
Subscribe to:
Posts (Atom)