Html5 With JSF 2.0
Html5 With JSF 2.0
Html5 With JSF 2.0
AGENDA
> HTML 5 Overview What is HTML 5? HTML 5 Features > JSF 2.0 Component Model And HTML 5 Component Model Overview Enhancing Components With HTML 5 > Demos
What Is HTML 5?
> Proposed next standard for HTML 4.0.1, XHTML 1.0 and DOM Level 2 HTML > Features promote RIA
HTML
HTML5
JS APIs
> Pioneered in 2004; First working spec draft: 2008 > CSS 3 : Working Draft April 2010
What Is HTML 5?
Traditional Desktop
User Experience
HTML5 Ajax
2005
2009
> Some advantages: Nested sections with header levels beyond 6 levels in HTML 4 Cleaner source; easier to author (don't need to go div crazy)
6
> Specify multiple audio file formats: browser will use first recognized format > controls attribute: adds play, pause, and volume controls
> Specify multiple video file formats: browser will use first recognized format > controls attribute: adds play, pause, and volume controls
9
<canvas id=aCanvas height=80 width=100> </canvas> <script type="text/javascript"> var canvas=document.getElementById('aCanvas'); var context=canvas.getContext('2d'); context.fillStyle='#FF0000'; context.fillRect(0,0,80,100); </script>
10
ctx.fillRect(5,2,3,3);
(0,0)
11
12
14
15
<canvas id="example" width="200" height="200"> ... </canvas> var example = document.getElementById('example'); var context = example.getContext('2d'); context.fillStyle = "rgb(255,0,0)"; context.fillRect(30, 30, 50, 50);
16
17
var ws = new WebSocket("ws://www.websocket.org"); ws.onopen = function(evt) { alert("Connection open ..."); }; ws.send(data); ws.onmessage = function(evt) { alert( "Msg: " + evt.data); }; ws.onclose = function(evt) { alert("Connection closed."); }; ws.disconnect();
18
19
20
21
22
Component (XHTML)
23
24
25
<html...xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"> <h:form> <div id="compositeComponent" class="grayBox" style="border: 1px solid #090;"> <ez:loginPanel > <f:actionListener for=loginAction binding=#{bean.action} /> </ez:loginPanel> </div> <p><h:commandButton value="reload" /></p> </h:form>
27
28
29
<html... 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:cc="http://java.sun.com/jsf/composite"> <h:head> ... </h:head> <h:body> <cc:interface> <cc:attribute name=src required=true /> <cc:attribute name=controls required=false /> </cc:interface> <cc:implementation> <h:outputScript library=js name=audio.js target=head/> <audio src="#{cc.attrs.src}" controls="#{cc.attrs.controls}"></audio> <input type=button value=Play onclick=play()/> <input type=button value=Pause onclick=pause()/> </cc:implementation> </h:body>
30
31
32
DEMOS
33
What's Next?
> With respect to JSF: JSF 2.0 Rev A (Minor Maintenance Release) JSF 2.1 (Major Maintenance Release) > We would like to hear from you!
34
Summary
> HTML 5 Really about markup and JavaScript API > HTML 5 Features Promote Rich User Interfaces Graphics Media Multiprocessing Communication
> JSF 2.0 Components work well with JavaScript Leverage HTML 5 JavaScript APIs > Future Directions
35
Resources
> http://glassfish.dev.java.net > http://javaserverfaces.dev.java.net > http://dev.w3.org/html5/spec/Overview.html > http://dev.w3.org/html5/websockets > http://grizzly.dev.java.net
36