SlideShare ist ein Scribd-Unternehmen logo
1 von 177
16-11-09 JSF 2 and beyond: Keeping progress coming Andy Schwartz -  Oracle Corporation Dan Allen & Pete Muir -  Red Hat, Inc.
16-11-09 See how far JSF 2 has come, explore the community’s role and take a glimpse at JSF 2.next Goals
16-11-09 Join in! Twitter hashtag:  #jsf2next
16-11-09 Join in! JSF 2 and beyond: BOF Tonight @ 20:00 in Room 2!
16-11-09 Andy Schwartz ,[object Object],[object Object],[object Object],http://andyschwartz.wordpress.com
16-11-09 Pete Muir ,[object Object],[object Object],[object Object],http://in.relation.to/Bloggers/Pete
16-11-09 Dan Allen ,[object Object],[object Object],[object Object],[object Object],http://mojavelinux.com
16-11-09 Many  faces  of JSF 2 Andy  Schwartz Dan Allen Jacob Hookom Alexandr Smirnov Ken Paulsen Martin Marinschek Matthias Wess endorf Pete Muir Alexander Jesse Imre O ßwald Yara Senger Lincoln Baxter Adam Winer Craig McClanahan Kito Mann Rick Hightower Joe Ottinger Ted Goddard Neil Griffin Jason Lee Stan Silvert David Geary Micheal Freedman Hazem Saleh Çağata Çivici Dennis Byrne Roger Keays Amy Fowler Max Katz Jeremy Grelle Keith Donald Emmanuel Bernard Ed Burns Jim Driscoll Roger Kitain Ryan Lubke Nick Belaevski Gavin King
Topic areas ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],16-11-09 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],(Andy) (Dan) (Pete) (Dan)
16-11-09 View declaration Facelets, View Declaration Language API
16-11-09 The problem
16-11-09 JSP pain points ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 The solution Facelets (Thanks, Jacob!)
16-11-09 Breaking free with Facelets ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 The problem revisited But, Facelets isn’t standard :(
16-11-09 The solution revisited Now it  is !
16-11-09 The solution 2.0 ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 View Declaration Language API ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Facelets and VDL: JSF2.next ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Component development Java components, composite components
16-11-09 The problem Component development is hard!
16-11-09 The problem in detail ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 The solution: Take 1 Simplify Java component development
16-11-09 The solution: Take 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 The solution: Take 2 Composite components!
16-11-09 Composite components ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Composite component definition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Composite component definition 16-11-09 <composite:interface> <composite:attribute  name = &quot;name&quot;   default = &quot;World&quot; /> </composite:interface> <composite:implementation> Hello, #{cc.attrs.name}! </composite:implementation> resources/foo/greeting.xhtml
Composite component usage 16-11-09 <html   xmlns = &quot;http://www.w3.org/1999/xhtml&quot; xmlns:h = &quot;http://java.sun.com/jsf/html&quot; xmlns:foo=&quot;http://java.sun.com/jsf/composite/foo&quot; > <body> <foo:greeting name=&quot;Devoxx&quot;/> </body> </html>
16-11-09 Composite components ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Component development: JSF2.next ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Ajax jsf.ajax.request(), <f:ajax>, Ajax Java APIs, and tree visiting
16-11-09 The problem JSF/Ajax Overload!
16-11-09 Where things went wrong ,[object Object],[object Object],[object Object]
16-11-09 The solution Standard Ajax APIs
16-11-09 The solution in detail ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 jsf.ajax.request() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
jsf.ajax.request() 16-11-09 <h:outputScript  name = &quot;jsf.js&quot;   library = &quot;javax.faces&quot; /> ... <h:commandButton  value = &quot;Do something Ajaxy&quot; onclick = &quot;jsf.ajax.request(this, event, {render: ' out '}); return false;&quot; /> ... <h:outputText   id = &quot; out &quot;   value = &quot;Update me!&quot; />
16-11-09 <f:ajax> ,[object Object],[object Object]
<f:ajax> nesting 16-11-09 <h:commandButton  value = &quot;Do something Ajaxy&quot; > <f:ajax  render = &quot; out &quot; /> </h:commandButton> ... <h:outputText  id = &quot; out &quot;   value = &quot;Update me!&quot; />
<f:ajax> wrapping 16-11-09 <f:ajax  render = &quot; out &quot; /> <h:commandButton  value = &quot;Do something Ajaxy&quot; /> <h:commandButton  value = &quot;Do something else&quot; /> <h:commandButton  value = &quot;One more here&quot; /> </f:ajax> ... <h:outputText  id = &quot; out &quot;   value = &quot;Update me!&quot; />
<f:ajax> client events 16-11-09 <h:commandButton> <f:ajax  event = &quot;mouseover&quot; /> </h:commandButton> ... <h:inputText> <f:ajax  event = &quot;focus&quot; /> </h:commandButton>
16-11-09 Ajax Java APIs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Ajax: JSF2.next ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Behaviors ClientBehavior, ClientBehaviorHolder
16-11-09 The problem It’s not just about Ajax
16-11-09 Think bigger ,[object Object],[object Object],[object Object]
16-11-09 The solution New contract: separate behavior from component
16-11-09 ClientBehavior API ,[object Object],[object Object],[object Object],[object Object],[object Object]
ClientBehavior sample 16-11-09 @FacesBehavior ( &quot;org.demo.behavior.Greet&quot; ) public class  GreetBehavior  extends  ClientBehaviorBase { @Override public String getScript(ClientBehaviorContext ctx) { return   &quot;alert('Hello, World!')&quot; ; } }
ClientBehavior sample 16-11-09 <h:commandButton  value = &quot;Do something Ajaxy&quot; > <f:ajax/> </h:commandButton> <h:commandButton  value = &quot;Say Hello&quot; > <foo:greet/> </h:commandButton>
16-11-09 What else is possible? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 ClientBehaviorHolder API ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 ClientBehaviorHolder API ,[object Object],[object Object],[object Object],[object Object]
16-11-09 Behaviors: JSF2.next ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 State saving Partial state saving, state helper
16-11-09 The problem State saving is nasty
16-11-09 public  Object saveState(FacesContext ctx) { if ( _values  ==  null ) { _values  =  new  Object[10]; } _values [0] =  super .saveState(ctx); _values [1] =  accesskey ; _values [2] =  alt ; _values [3] =  dir ; _values [4] =  disabled ; _values [5] =  image ; _values [6] =  label ; _values [7] =  lang ; _values [8] =  onblur ; _values [9] =  onchange ; return  _values ; } public void  restoreState( FacesContext ctx, Object _state) { _values  = (Object[]) state; super .restoreState(ctx,  _values [0]); this . accesskey  = (java.lang.String)  _values [1]; this . alt  = (java.lang.String)  _values [2]; this . dir  = (java.lang.String)  _values [3]; this . disabled  = (java.lang.Boolean)  _values [4]; this . image  = (java.lang.String)  _values [5]; this . label  = (java.lang.String)  _values [6]; this . lang  = (java.lang.String)  _values [7]; this . onblur  = (java.lang.String)  _values [8]; this . onchange  = (java.lang.String)  _values [9]; } State saving lunacy
16-11-09 Another problem State saving is expensive
16-11-09 State overhead ,[object Object],[object Object],[object Object],[object Object]
16-11-09 The solution Partial state saving for smaller state. State helper utilites for happier component developers.
16-11-09 Partial state saving ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Partial state saving ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 State saving 2.0 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 State saving: JSF2.next ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Controller GET support, bookmarkable URLs, navigation and redirects, and resource loading
16-11-09 GET support View metadata, view parameters, pre-render event listeners and bookmarkable URL components
Consuming 16-11-09 http://acme.org/catalog.jsf?page=2  http://acme.org/item.jsf?id=4
Initial request lifecycle 16-11-09 http://acme.org/catalog.jsf?cat=electronics&page=3&layout=grid
Initial data 16-11-09 http://acme.org/ catalog.jsf ?cat=electronics&page=3&layout=grid view ID /catalog.xhtml
Initial data 16-11-09 http://acme.org/catalog.jsf? cat=electronics&page=3&layout=grid request parameters cat=electronics page=3 layout=grid
Bean property mapping 16-11-09 <managed-bean> ... <managed-bean-property> <property-name> category </property-name> <value> #{param['cat']} </value> </managed-bean-property> </managed-bean>
16-11-09 Bean property mapping limitations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Need more sophisticated, view-oriented mapping
16-11-09 View metadata ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],#{...}
Reuse the tree 16-11-09
View metadata facet 16-11-09 <f:view> <f:metadata> ... </f:metadata> ... </f:view>
16-11-09 View metadata facet ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 View metadata lifecycle ,[object Object],[object Object],[object Object],[object Object],[object Object],meta
View parameter 16-11-09 <f:view> <f:metadata> <f:viewParam name=&quot;cat&quot; value=&quot;#{catalogBean.category}&quot;/> </f:metadata> ... </f:view> UIViewParameter
View parameter w/ converter 16-11-09 <f:view> <f:metadata> <f:viewParam  name = &quot;cat&quot;   value = &quot;#{catalogBean.category}&quot; > <f:converter converterId=&quot;com.acme.converter.Category&quot;/> </f:viewParam> </f:metadata> ... </f:view> UIViewParameter
16-11-09 View parameter assignment ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],UIInput UIViewParameter
View metadata templating 16-11-09 <f:view> <f:metadata> <ui:include   src = &quot;/WEB-INF/metadata/catalog.xhtml&quot; /> [ or ] <acme:catalogMetadata/> </f:metadata> ... </f:view> More powerful & flexible than a matching pattern
16-11-09 Post-processing The values are set, now what?
16-11-09 Component system events ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Post-mapping event listener 16-11-09 <f:view> <f:metadata> ... <f:event   type = &quot; preRenderView &quot;   listener = &quot;#{catalogBean.onRender}&quot; /> </f:metadata> ... </f:view> Declarative system event No-args method or method that accepts  ComponentSystemEvent
Hold the rendering! 16-11-09 public void  onRender() { FacesContext ctx = FacesContext.getCurrentInstance(); if  (ctx.isValidationFailed() || !loadDataAttempt()) { ctx.getApplication().getNavigationHandler() .handleNavigation(ctx,  null ,  &quot;invalid&quot; ); } } Force navigation if preconditions not met
Report downloads 16-11-09 <view   xmlns = &quot;http://java.sun.com/jsf/core&quot; > <event   type = &quot;preRenderView&quot;   listener = &quot;#{reportBean.download}&quot; /> </view>
Pushing the file 16-11-09 public void  download() { FacesContext ctx = FacesContext.getCurrentInstance(); pushFile( ctx.getExternalContext(), &quot;/path/to/a/pdf/file.pdf&quot; , &quot;file.pdf&quot; );  ctx.responseComplete() ; }
View actions 16-11-09 <f:view> <f:metadata> ... <f:viewAction execute=&quot;#{catalogBean.onRender}&quot;/> </f:metadata> ... </f:view> Wouldn’t it be nice if we had...? JSF 2.next Including option to disable on postback
View actions 16-11-09 <navigation-rule> <from-view-id> /catalog.xhtml </from-view-id> <navigation-case> <from-action> #{catalogBean.onRender} </from-action> <from-outcome> failure </from-outcome> <to-view-id> /search.xhtml </to-view-id> </navigation-case> </navigation-rule> ...followed by buit-in navigation? JSF 2.next
16-11-09 View actions vs PreRenderView ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How do we process this URL? 16-11-09 http://acme.org/catalog/category/electronics
Pretty URLs 16-11-09 <rewrite-rule> <rewrite-view-id> /catalog.xhtml </rewrite-view-id> <rewrite-case> <url-pattern> /catalog </url-pattern> <url-pattern> /catalog/category/ {cat} </url-pattern> <url-pattern> /catalog/category/ {cat} / {page} </url-pattern> </rewrite-case> </rewrite-rule> JSF 2.next View parameter mappings
Producing 16-11-09
16-11-09 UIOutputLink ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<h:outputLink value=&quot;/home.jsf&quot;>Home</h:outputLink>
16-11-09 UIOutcomeTarget ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<h:link outcome=&quot;home&quot; value=&quot;Home&quot;/>
Generating bookmarkable links 16-11-09 <h:link   value = &quot;Previous&quot;   includeViewParams = &quot;true&quot; > <f:param   name = &quot;page&quot;   value = &quot;#{catalogBean.previousPage}&quot; /> </h:link> <f:metadata> <f:viewParam   name = &quot;q&quot;   value = &quot;#{catalogBean.query}&quot; /> <f:viewParam   name = &quot;page&quot;   value = &quot;#{catalogBean.page}&quot; /> </f:metadata> http://acme.org/catalog.jsf? q=portable+hole & page=3 /catalog.xhtml
16-11-09 GET support: JSF 2.next ,[object Object],[object Object],[object Object],[object Object]
16-11-09 Navigation Implicit, conditional and preemptive navigation, queryable navigation rules and redirect parameters
16-11-09 Implicit navigation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Tweaking implicit navigation ,[object Object],[object Object],[object Object],[object Object]
A navigation shorthand 16-11-09 <h:commandButton   action = &quot;#{productBean.save}&quot;   value = &quot;Save&quot; /> public  String save() { // perform save logic, then... return   &quot;/catalog.xhtml&quot; ; }
A navigation short (er) hand 16-11-09 Can link to navigation case later <h:commandButton   action = &quot;#{productBean.save}&quot;   value = &quot;Save&quot; /> public  String save() { // perform save logic, then... return   &quot; catalog &quot; ; } Relative to current path and view ID
16-11-09 Logical outcomes aren’t logical ,[object Object],[object Object],[object Object]
16-11-09 Conditional navigation ,[object Object],[object Object],[object Object],[object Object],[object Object],Web tier Transactional tier
A conditional case 16-11-09 <navigation-case> <from-action> #{registration.register} </from-action> <if>#{currentUser.registered}</if> <to-view-id> /account.xhtml </to-view-id> <redirect   include-view-params = &quot;true&quot; /> </navigation-case>
Matching a void outcome 16-11-09 <navigation-case> <from-action> #{catalog.search} </from-action> <if>#{true}</if> <to-view-id> /results.xhtml </to-view-id> </navigation-case>
16-11-09 Preemptive navigation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Bookmarkable link 16-11-09 <h:link   outcome = &quot;product&quot;   value = &quot;View&quot; > <f:param   name = &quot;id&quot;   value = &quot;#{product.id}&quot; /> </h:link> <a href=&quot;/product.jsf?id=3&quot;>View</a>
16-11-09 Redirect parameters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Redirect after POST the  hard  way 16-11-09 FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext extCtx = ctx.getExternalContext(); String url = ctx.getApplication().getViewHandler() .getActionURL(ctx,  &quot;/product.xhtml&quot; ) +  &quot;?id=&quot;  + getProductId(); try  { extCtx.redirect(extCtx.encodeActionURL(url)); }  catch  (IOException ioe) { throw new FacesException(ioe); }
Redirect after POST the  easier  way 16-11-09 <navigation-case> <from-action> #{productBean.save} </from-action> <if> #{productBean.id != null} </if> <to-view-id> /product.xhtml </to-view-id> <redirect> <view-param> <name> id </name> <value> #{productBean.id} </value> </view-param> </redirect> </navigation-case>
Redirect after POST the  best  way 16-11-09 <navigation-case> <from-action> #{productBean.save} </from-action> <if> #{productBean.id != null} </if> <to-view-id> /product.xhtml </to-view-id> <redirect  include-view-params = &quot;true&quot; /> </navigation-case>
16-11-09 Navigation: JSF 2.next ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Resource handling Native resource handling, packaging and resource relocation
16-11-09 No more  “bonus”  servlet!
16-11-09 Resource handling ,[object Object],[object Object],[object Object],[object Object],[object Object]
Declarative component resources 16-11-09 @ResourceDependency ( name =  &quot;jsf.js&quot; , library =  &quot;javax.faces&quot; , target =  &quot;head&quot; ) public class  MyComponent  extends  UIOutput { ... }
16-11-09 A resource at a glance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 A third request processing scenario
16-11-09 Resolving a resource ,[object Object],[object Object],[object Object],[object Object],[object Object],localePrefix/libraryName/libraryVersion/ resourceName /resourceVersion Path segments in grey are optional
16-11-09 Resource relocation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Resources: JSF 2.next ,[object Object],[object Object],[object Object]
16-11-09 Model Java EE 6 component model, Bean Validation, error handling and resource loading
16-11-09 Java EE 6: Goals ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Java EE 6: Newcomers ,[object Object],[object Object],[object Object],[object Object]
16-11-09 Java EE 6: Notable updates ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],...and JSF 2.0, of course!
16-11-09 Web profile contents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 JSR-299: Essential ingredients ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Simple example 16-11-09 public class  Hello {  public  String sayHello(String name) {  return   &quot;Hello, &quot;  + name;  }  } @Stateless public class  Hello {  public  String sayHello(String name) {  return   &quot;Hello, &quot;  + name;  }  } Any Managed Bean can use CDI services ...even EJBs!
Simple example 16-11-09 public class  Printer { @Inject  Hello  hello ; public  void printHello() {  System.out.println( hello .sayHello( &quot;Devoxx&quot; ));  }  } @Inject  defines injection point, assumes  @Default qualifier
Constructor injection 16-11-09 public class  Printer {  private  Hello  hello ;  @Inject public  Printer(Hello hello) {  this . hello  = hello; }  public void  printHello() {  System. out .println( hello .sayHello( &quot;Devoxx&quot; ));  }  } @Inject  marks constructor to be called by container; arguments injected automatically
Bean EL names 16-11-09 @Named( &quot;hello&quot; )  public class  Hello { private  String name;  // getters and setters not shown  public   void  sayHello() {  System. out .println( &quot;Hello, &quot;  + name);  }  } @Named  public class  Hello { ... } @Named  makes bean available to EL Name can be defaulted to simple name of class
JSF view 16-11-09 <h:inputText   value = &quot;#{hello.name}&quot; /> <h:commandButton   value = &quot;Say Hello&quot;   action = &quot;#{hello.sayHello}&quot; /> Invoking a bean via EL
16-11-09 Qualifier An annotation that lets a client choose between multiple implementations of an API at runtime
Write a qualified implementation 16-11-09 @Casual  public class  Hi  extends  Hello {  public  String sayHello(String name) {  return  &quot;Hi, &quot;  + name;  }  } This second Hello bean is qualified  @Casual
Using a qualifier 16-11-09 public class  Printer { @Inject  @Casual  Hello  hello ; public void printHello() {  System. out .println( hello .sayHello( &quot;Devoxx&quot; ));  }  } Injects the  @Casual implementation of Hello
16-11-09 Scopes and contexts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Producer methods ,[object Object],[object Object],[object Object],[object Object]
16-11-09 Parameterized EL methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Validation Bean Validation integration, validating empty fields and multi-field validation with post-validate events
16-11-09 One model... ...validated across multiple layers Constraints in the enterprise User String username String email
16-11-09 Bean Validation (JSR-303) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Defining constraints on the model 16-11-09 public class  User { ... @NotNull @Size(min = 3, max = 25) public  String getUsername() {  return   username ; } @NotNull @Email public  String getEmail() {  return   email ; } }
16-11-09 One model... ...validated across multiple layers Constraints in JSF User String username String email
Enforcing constraints in the UI 16-11-09 <h:inputText  id = &quot;username&quot;   value = &quot;#{user.username}&quot; /> <h:inputText  id = &quot;email&quot;   value = &quot;#{user.email}&quot; /> Zeroconf!
Constraining partially 16-11-09 <h:inputText   id = &quot;username&quot;   value = &quot;#{user.username}&quot; > <f:validateBean  disabled = &quot;true&quot; /> </h:inputText> <f:validateBean  validationGroups = &quot;com.acme.BareMinimum&quot; > <h:inputText  id = &quot;email&quot;   value = &quot;#{user.email}&quot; /> </:validateBean>
16-11-09 The case of the empty field ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Do you mean null? ,[object Object],[object Object],[object Object],<context-param>   <param-name>   javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL   </param-name>   <param-value> true </param-value> </context-param>
16-11-09 Multi-field validation ,[object Object],[object Object],[object Object],[object Object],Before  model update After  model update ,[object Object],[object Object]
Listening for post validate 16-11-09 <h:form> <f:event type=&quot;postValidate&quot; listener=&quot;#{minMax.validate}&quot;/> <h:inputText  id = &quot;min&quot;   value = &quot;#{bean.min}&quot; binding = &quot;#{minMax.minInput}&quot; /> <h:inputText  id = &quot;max&quot;   value = &quot;#{bean.max}&quot; binding = &quot;#{minMax.maxInput}&quot; /> <h:commandButton  value = &quot;Submit&quot; /> </h:form>
Validating across fields 16-11-09 @Inject  FacesContext  ctx ; private UIInput  minInput ,  maxInput ;  // accessors hidden public void   validate () { if  ( ctx .isValidationFailed()) {  return ; } if  ((Integer)  maxInput .getValue() < (Integer)  minInput .getValue()) { ctx.addMessage( maxInput .getClientId(ctx), new  FacesMessage( &quot;cannot be less than min value&quot; )); ctx.validationFailed() ; ctx.renderResponse(); } }
16-11-09 Validation JSF.next ,[object Object],[object Object],[object Object]
16-11-09 Error handling Exception handlers, exception events, servlet errors and the default error page
16-11-09 The good news No more swallowed exceptions!
16-11-09 The bad news You’re still going to get exceptions
16-11-09 Exception handler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Ugh!
16-11-09 Default error page
16-11-09 Development diagnostics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],/javax.faces.error.xhtml
[object Object],[object Object],[object Object],[object Object],[object Object],16-11-09 Bubbling over in production <error-page>   <exception-type> com.acme.SecurityException </exception-type>   <location> /accessDenied.jsf </location> </error-page>
Declarative error handling  in JSF 16-11-09 <exception  class = &quot;javax.persistence.EntityNotFoundException&quot; > <redirect  view-id = &quot;/error/404.xhtml&quot; > <message  severity = &quot;warn&quot; > Record not found </message> </redirect> </exception> Wouldn’t it be nice if we had...? JSF 2.next
16-11-09 Ajax error handling ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Pain relief Select items from collections, validation failed flag, API improvements, varStatus on ui:repeat, and more...
From collection to select items 16-11-09 <h:selectOneMenu  value = &quot;#{product.category}&quot; > <f:selectItems  value = &quot; #{catalogBean.categories} &quot;   var = &quot;cat&quot; itemLabel = &quot;#{cat.name}&quot;   itemValue = &quot;#{cat}&quot; noSelectionValue = &quot;#{catalogBean.defaultCatalog}&quot; /> </h:selectOneMenu> @Named public class  CatalogBean { public  List<Category> getCategories() { return  ...; } }
16-11-09 Minor improvements that add up ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Pain relief: JSF 2.next ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Community JSR-314-OPEN mailinglist, javaserverfaces-spec-public project, JCP.org and  you !
16-11-09 Steps towards openness ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Next steps ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Creating a JCP.org profile Did you know that anyone can have a JCP.org profile? Just sign up!
16-11-09 JCP.org 2.0 - Launched June 2009 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 Becoming a JCP member Did you know that anyone can become a JCP member?  Just sign the JSPA!
16-11-09 JCP membership fee (JSPA) ,[object Object],[object Object],[object Object],[object Object]
16-11-09 Membership benefits ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 JSF community home page ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],http://javaserverfaces.org   (future)
16-11-09 Summary ,[object Object],[object Object],[object Object],[object Object],[object Object]
16-11-09 See you at the JSF 2 BOF! (20:00) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component BehaviorsAndy Schwartz
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCJohn Lewis
 
Spring MVC
Spring MVCSpring MVC
Spring MVCyuvalb
 
9. java server faces
9. java server faces9. java server faces
9. java server facesAnusAhmad
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Arun Gupta
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC SeminarJohn Lewis
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkGuo Albert
 
What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0Michael Fons
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and DeploymentBG Java EE Course
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVCGuy Nir
 

Was ist angesagt? (20)

JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Jsf
JsfJsf
Jsf
 
Introduction to jsf 2
Introduction to jsf 2Introduction to jsf 2
Introduction to jsf 2
 
Struts N E W
Struts N E WStruts N E W
Struts N E W
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
 
9. java server faces
9. java server faces9. java server faces
9. java server faces
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC Seminar
 
Unified Expression Language
Unified Expression LanguageUnified Expression Language
Unified Expression Language
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Ibm
IbmIbm
Ibm
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
 
Struts,Jsp,Servlet
Struts,Jsp,ServletStruts,Jsp,Servlet
Struts,Jsp,Servlet
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0What's new and exciting with JSF 2.0
What's new and exciting with JSF 2.0
 
Jsf presentation
Jsf presentationJsf presentation
Jsf presentation
 
Web Applications and Deployment
Web Applications and DeploymentWeb Applications and Deployment
Web Applications and Deployment
 
Spring 3.x - Spring MVC
Spring 3.x - Spring MVCSpring 3.x - Spring MVC
Spring 3.x - Spring MVC
 

Ähnlich wie JSF 2 and beyond: Keeping progress coming

Andy Bosch - JavaServer Faces in the cloud
Andy Bosch -  JavaServer Faces in the cloudAndy Bosch -  JavaServer Faces in the cloud
Andy Bosch - JavaServer Faces in the cloudAndy Bosch
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergFelix Arntz
 
Writing a massive javascript app
Writing a massive javascript appWriting a massive javascript app
Writing a massive javascript appJustin Park
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day trainingTroy Miles
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Edward Burns
 
What's cool in Apache MyFaces?
What's cool in Apache MyFaces?What's cool in Apache MyFaces?
What's cool in Apache MyFaces?aliok
 
OttawaJS - React
OttawaJS - ReactOttawaJS - React
OttawaJS - Reactrbl002
 
JSF and Seam
JSF and SeamJSF and Seam
JSF and Seamyuvalb
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)Chiew Carol
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWTArnaud Tournier
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesPeter Gfader
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web appsFastly
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSAntonio Peric-Mazar
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 

Ähnlich wie JSF 2 and beyond: Keeping progress coming (20)

Andy Bosch - JavaServer Faces in the cloud
Andy Bosch -  JavaServer Faces in the cloudAndy Bosch -  JavaServer Faces in the cloud
Andy Bosch - JavaServer Faces in the cloud
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in Gutenberg
 
Writing a massive javascript app
Writing a massive javascript appWriting a massive javascript app
Writing a massive javascript app
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015
 
What's cool in Apache MyFaces?
What's cool in Apache MyFaces?What's cool in Apache MyFaces?
What's cool in Apache MyFaces?
 
Html5 communication
Html5 communicationHtml5 communication
Html5 communication
 
OttawaJS - React
OttawaJS - ReactOttawaJS - React
OttawaJS - React
 
JSF and Seam
JSF and SeamJSF and Seam
JSF and Seam
 
Red5 - PHUG Workshops
Red5 - PHUG WorkshopsRed5 - PHUG Workshops
Red5 - PHUG Workshops
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
CAF & Portlet Development Notes
CAF & Portlet Development NotesCAF & Portlet Development Notes
CAF & Portlet Development Notes
 
Easing offline web application development with GWT
Easing offline web application development with GWTEasing offline web application development with GWT
Easing offline web application development with GWT
 
Usability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET FeaturesUsability AJAX and other ASP.NET Features
Usability AJAX and other ASP.NET Features
 
JSF 2.0 Preview
JSF 2.0 PreviewJSF 2.0 Preview
JSF 2.0 Preview
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
 
Building Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJSBuilding Single Page Application (SPA) with Symfony2 and AngularJS
Building Single Page Application (SPA) with Symfony2 and AngularJS
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
Lecture 3 Javascript1
Lecture 3  Javascript1Lecture 3  Javascript1
Lecture 3 Javascript1
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 

Kürzlich hochgeladen

Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Kürzlich hochgeladen (20)

Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

JSF 2 and beyond: Keeping progress coming

  • 1. 16-11-09 JSF 2 and beyond: Keeping progress coming Andy Schwartz - Oracle Corporation Dan Allen & Pete Muir - Red Hat, Inc.
  • 2. 16-11-09 See how far JSF 2 has come, explore the community’s role and take a glimpse at JSF 2.next Goals
  • 3. 16-11-09 Join in! Twitter hashtag: #jsf2next
  • 4. 16-11-09 Join in! JSF 2 and beyond: BOF Tonight @ 20:00 in Room 2!
  • 5.
  • 6.
  • 7.
  • 8. 16-11-09 Many faces of JSF 2 Andy Schwartz Dan Allen Jacob Hookom Alexandr Smirnov Ken Paulsen Martin Marinschek Matthias Wess endorf Pete Muir Alexander Jesse Imre O ßwald Yara Senger Lincoln Baxter Adam Winer Craig McClanahan Kito Mann Rick Hightower Joe Ottinger Ted Goddard Neil Griffin Jason Lee Stan Silvert David Geary Micheal Freedman Hazem Saleh Çağata Çivici Dennis Byrne Roger Keays Amy Fowler Max Katz Jeremy Grelle Keith Donald Emmanuel Bernard Ed Burns Jim Driscoll Roger Kitain Ryan Lubke Nick Belaevski Gavin King
  • 9.
  • 10. 16-11-09 View declaration Facelets, View Declaration Language API
  • 12.
  • 13. 16-11-09 The solution Facelets (Thanks, Jacob!)
  • 14.
  • 15. 16-11-09 The problem revisited But, Facelets isn’t standard :(
  • 16. 16-11-09 The solution revisited Now it is !
  • 17.
  • 18.
  • 19.
  • 20. 16-11-09 Component development Java components, composite components
  • 21. 16-11-09 The problem Component development is hard!
  • 22.
  • 23. 16-11-09 The solution: Take 1 Simplify Java component development
  • 24.
  • 25. 16-11-09 The solution: Take 2 Composite components!
  • 26.
  • 27.
  • 28. Composite component definition 16-11-09 <composite:interface> <composite:attribute name = &quot;name&quot; default = &quot;World&quot; /> </composite:interface> <composite:implementation> Hello, #{cc.attrs.name}! </composite:implementation> resources/foo/greeting.xhtml
  • 29. Composite component usage 16-11-09 <html xmlns = &quot;http://www.w3.org/1999/xhtml&quot; xmlns:h = &quot;http://java.sun.com/jsf/html&quot; xmlns:foo=&quot;http://java.sun.com/jsf/composite/foo&quot; > <body> <foo:greeting name=&quot;Devoxx&quot;/> </body> </html>
  • 30.
  • 31.
  • 32. 16-11-09 Ajax jsf.ajax.request(), <f:ajax>, Ajax Java APIs, and tree visiting
  • 33. 16-11-09 The problem JSF/Ajax Overload!
  • 34.
  • 35. 16-11-09 The solution Standard Ajax APIs
  • 36.
  • 37.
  • 38. jsf.ajax.request() 16-11-09 <h:outputScript name = &quot;jsf.js&quot; library = &quot;javax.faces&quot; /> ... <h:commandButton value = &quot;Do something Ajaxy&quot; onclick = &quot;jsf.ajax.request(this, event, {render: ' out '}); return false;&quot; /> ... <h:outputText id = &quot; out &quot; value = &quot;Update me!&quot; />
  • 39.
  • 40. <f:ajax> nesting 16-11-09 <h:commandButton value = &quot;Do something Ajaxy&quot; > <f:ajax render = &quot; out &quot; /> </h:commandButton> ... <h:outputText id = &quot; out &quot; value = &quot;Update me!&quot; />
  • 41. <f:ajax> wrapping 16-11-09 <f:ajax render = &quot; out &quot; /> <h:commandButton value = &quot;Do something Ajaxy&quot; /> <h:commandButton value = &quot;Do something else&quot; /> <h:commandButton value = &quot;One more here&quot; /> </f:ajax> ... <h:outputText id = &quot; out &quot; value = &quot;Update me!&quot; />
  • 42. <f:ajax> client events 16-11-09 <h:commandButton> <f:ajax event = &quot;mouseover&quot; /> </h:commandButton> ... <h:inputText> <f:ajax event = &quot;focus&quot; /> </h:commandButton>
  • 43.
  • 44.
  • 45. 16-11-09 Behaviors ClientBehavior, ClientBehaviorHolder
  • 46. 16-11-09 The problem It’s not just about Ajax
  • 47.
  • 48. 16-11-09 The solution New contract: separate behavior from component
  • 49.
  • 50. ClientBehavior sample 16-11-09 @FacesBehavior ( &quot;org.demo.behavior.Greet&quot; ) public class GreetBehavior extends ClientBehaviorBase { @Override public String getScript(ClientBehaviorContext ctx) { return &quot;alert('Hello, World!')&quot; ; } }
  • 51. ClientBehavior sample 16-11-09 <h:commandButton value = &quot;Do something Ajaxy&quot; > <f:ajax/> </h:commandButton> <h:commandButton value = &quot;Say Hello&quot; > <foo:greet/> </h:commandButton>
  • 52.
  • 53.
  • 54.
  • 55.
  • 56. 16-11-09 State saving Partial state saving, state helper
  • 57. 16-11-09 The problem State saving is nasty
  • 58. 16-11-09 public Object saveState(FacesContext ctx) { if ( _values == null ) { _values = new Object[10]; } _values [0] = super .saveState(ctx); _values [1] = accesskey ; _values [2] = alt ; _values [3] = dir ; _values [4] = disabled ; _values [5] = image ; _values [6] = label ; _values [7] = lang ; _values [8] = onblur ; _values [9] = onchange ; return _values ; } public void restoreState( FacesContext ctx, Object _state) { _values = (Object[]) state; super .restoreState(ctx, _values [0]); this . accesskey = (java.lang.String) _values [1]; this . alt = (java.lang.String) _values [2]; this . dir = (java.lang.String) _values [3]; this . disabled = (java.lang.Boolean) _values [4]; this . image = (java.lang.String) _values [5]; this . label = (java.lang.String) _values [6]; this . lang = (java.lang.String) _values [7]; this . onblur = (java.lang.String) _values [8]; this . onchange = (java.lang.String) _values [9]; } State saving lunacy
  • 59. 16-11-09 Another problem State saving is expensive
  • 60.
  • 61. 16-11-09 The solution Partial state saving for smaller state. State helper utilites for happier component developers.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66. 16-11-09 Controller GET support, bookmarkable URLs, navigation and redirects, and resource loading
  • 67. 16-11-09 GET support View metadata, view parameters, pre-render event listeners and bookmarkable URL components
  • 69. Initial request lifecycle 16-11-09 http://acme.org/catalog.jsf?cat=electronics&page=3&layout=grid
  • 70. Initial data 16-11-09 http://acme.org/ catalog.jsf ?cat=electronics&page=3&layout=grid view ID /catalog.xhtml
  • 71. Initial data 16-11-09 http://acme.org/catalog.jsf? cat=electronics&page=3&layout=grid request parameters cat=electronics page=3 layout=grid
  • 72. Bean property mapping 16-11-09 <managed-bean> ... <managed-bean-property> <property-name> category </property-name> <value> #{param['cat']} </value> </managed-bean-property> </managed-bean>
  • 73.
  • 74.
  • 75. Reuse the tree 16-11-09
  • 76. View metadata facet 16-11-09 <f:view> <f:metadata> ... </f:metadata> ... </f:view>
  • 77.
  • 78.
  • 79. View parameter 16-11-09 <f:view> <f:metadata> <f:viewParam name=&quot;cat&quot; value=&quot;#{catalogBean.category}&quot;/> </f:metadata> ... </f:view> UIViewParameter
  • 80. View parameter w/ converter 16-11-09 <f:view> <f:metadata> <f:viewParam name = &quot;cat&quot; value = &quot;#{catalogBean.category}&quot; > <f:converter converterId=&quot;com.acme.converter.Category&quot;/> </f:viewParam> </f:metadata> ... </f:view> UIViewParameter
  • 81.
  • 82. View metadata templating 16-11-09 <f:view> <f:metadata> <ui:include src = &quot;/WEB-INF/metadata/catalog.xhtml&quot; /> [ or ] <acme:catalogMetadata/> </f:metadata> ... </f:view> More powerful & flexible than a matching pattern
  • 83. 16-11-09 Post-processing The values are set, now what?
  • 84.
  • 85. Post-mapping event listener 16-11-09 <f:view> <f:metadata> ... <f:event type = &quot; preRenderView &quot; listener = &quot;#{catalogBean.onRender}&quot; /> </f:metadata> ... </f:view> Declarative system event No-args method or method that accepts ComponentSystemEvent
  • 86. Hold the rendering! 16-11-09 public void onRender() { FacesContext ctx = FacesContext.getCurrentInstance(); if (ctx.isValidationFailed() || !loadDataAttempt()) { ctx.getApplication().getNavigationHandler() .handleNavigation(ctx, null , &quot;invalid&quot; ); } } Force navigation if preconditions not met
  • 87. Report downloads 16-11-09 <view xmlns = &quot;http://java.sun.com/jsf/core&quot; > <event type = &quot;preRenderView&quot; listener = &quot;#{reportBean.download}&quot; /> </view>
  • 88. Pushing the file 16-11-09 public void download() { FacesContext ctx = FacesContext.getCurrentInstance(); pushFile( ctx.getExternalContext(), &quot;/path/to/a/pdf/file.pdf&quot; , &quot;file.pdf&quot; ); ctx.responseComplete() ; }
  • 89. View actions 16-11-09 <f:view> <f:metadata> ... <f:viewAction execute=&quot;#{catalogBean.onRender}&quot;/> </f:metadata> ... </f:view> Wouldn’t it be nice if we had...? JSF 2.next Including option to disable on postback
  • 90. View actions 16-11-09 <navigation-rule> <from-view-id> /catalog.xhtml </from-view-id> <navigation-case> <from-action> #{catalogBean.onRender} </from-action> <from-outcome> failure </from-outcome> <to-view-id> /search.xhtml </to-view-id> </navigation-case> </navigation-rule> ...followed by buit-in navigation? JSF 2.next
  • 91.
  • 92. How do we process this URL? 16-11-09 http://acme.org/catalog/category/electronics
  • 93. Pretty URLs 16-11-09 <rewrite-rule> <rewrite-view-id> /catalog.xhtml </rewrite-view-id> <rewrite-case> <url-pattern> /catalog </url-pattern> <url-pattern> /catalog/category/ {cat} </url-pattern> <url-pattern> /catalog/category/ {cat} / {page} </url-pattern> </rewrite-case> </rewrite-rule> JSF 2.next View parameter mappings
  • 95.
  • 96.
  • 97. Generating bookmarkable links 16-11-09 <h:link value = &quot;Previous&quot; includeViewParams = &quot;true&quot; > <f:param name = &quot;page&quot; value = &quot;#{catalogBean.previousPage}&quot; /> </h:link> <f:metadata> <f:viewParam name = &quot;q&quot; value = &quot;#{catalogBean.query}&quot; /> <f:viewParam name = &quot;page&quot; value = &quot;#{catalogBean.page}&quot; /> </f:metadata> http://acme.org/catalog.jsf? q=portable+hole & page=3 /catalog.xhtml
  • 98.
  • 99. 16-11-09 Navigation Implicit, conditional and preemptive navigation, queryable navigation rules and redirect parameters
  • 100.
  • 101.
  • 102. A navigation shorthand 16-11-09 <h:commandButton action = &quot;#{productBean.save}&quot; value = &quot;Save&quot; /> public String save() { // perform save logic, then... return &quot;/catalog.xhtml&quot; ; }
  • 103. A navigation short (er) hand 16-11-09 Can link to navigation case later <h:commandButton action = &quot;#{productBean.save}&quot; value = &quot;Save&quot; /> public String save() { // perform save logic, then... return &quot; catalog &quot; ; } Relative to current path and view ID
  • 104.
  • 105.
  • 106. A conditional case 16-11-09 <navigation-case> <from-action> #{registration.register} </from-action> <if>#{currentUser.registered}</if> <to-view-id> /account.xhtml </to-view-id> <redirect include-view-params = &quot;true&quot; /> </navigation-case>
  • 107. Matching a void outcome 16-11-09 <navigation-case> <from-action> #{catalog.search} </from-action> <if>#{true}</if> <to-view-id> /results.xhtml </to-view-id> </navigation-case>
  • 108.
  • 109. Bookmarkable link 16-11-09 <h:link outcome = &quot;product&quot; value = &quot;View&quot; > <f:param name = &quot;id&quot; value = &quot;#{product.id}&quot; /> </h:link> <a href=&quot;/product.jsf?id=3&quot;>View</a>
  • 110.
  • 111. Redirect after POST the hard way 16-11-09 FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext extCtx = ctx.getExternalContext(); String url = ctx.getApplication().getViewHandler() .getActionURL(ctx, &quot;/product.xhtml&quot; ) + &quot;?id=&quot; + getProductId(); try { extCtx.redirect(extCtx.encodeActionURL(url)); } catch (IOException ioe) { throw new FacesException(ioe); }
  • 112. Redirect after POST the easier way 16-11-09 <navigation-case> <from-action> #{productBean.save} </from-action> <if> #{productBean.id != null} </if> <to-view-id> /product.xhtml </to-view-id> <redirect> <view-param> <name> id </name> <value> #{productBean.id} </value> </view-param> </redirect> </navigation-case>
  • 113. Redirect after POST the best way 16-11-09 <navigation-case> <from-action> #{productBean.save} </from-action> <if> #{productBean.id != null} </if> <to-view-id> /product.xhtml </to-view-id> <redirect include-view-params = &quot;true&quot; /> </navigation-case>
  • 114.
  • 115. 16-11-09 Resource handling Native resource handling, packaging and resource relocation
  • 116. 16-11-09 No more “bonus” servlet!
  • 117.
  • 118. Declarative component resources 16-11-09 @ResourceDependency ( name = &quot;jsf.js&quot; , library = &quot;javax.faces&quot; , target = &quot;head&quot; ) public class MyComponent extends UIOutput { ... }
  • 119.
  • 120. 16-11-09 A third request processing scenario
  • 121.
  • 122.
  • 123.
  • 124. 16-11-09 Model Java EE 6 component model, Bean Validation, error handling and resource loading
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130. Simple example 16-11-09 public class Hello { public String sayHello(String name) { return &quot;Hello, &quot; + name; } } @Stateless public class Hello { public String sayHello(String name) { return &quot;Hello, &quot; + name; } } Any Managed Bean can use CDI services ...even EJBs!
  • 131. Simple example 16-11-09 public class Printer { @Inject Hello hello ; public void printHello() { System.out.println( hello .sayHello( &quot;Devoxx&quot; )); } } @Inject defines injection point, assumes @Default qualifier
  • 132. Constructor injection 16-11-09 public class Printer { private Hello hello ; @Inject public Printer(Hello hello) { this . hello = hello; } public void printHello() { System. out .println( hello .sayHello( &quot;Devoxx&quot; )); } } @Inject marks constructor to be called by container; arguments injected automatically
  • 133. Bean EL names 16-11-09 @Named( &quot;hello&quot; ) public class Hello { private String name; // getters and setters not shown public void sayHello() { System. out .println( &quot;Hello, &quot; + name); } } @Named public class Hello { ... } @Named makes bean available to EL Name can be defaulted to simple name of class
  • 134. JSF view 16-11-09 <h:inputText value = &quot;#{hello.name}&quot; /> <h:commandButton value = &quot;Say Hello&quot; action = &quot;#{hello.sayHello}&quot; /> Invoking a bean via EL
  • 135. 16-11-09 Qualifier An annotation that lets a client choose between multiple implementations of an API at runtime
  • 136. Write a qualified implementation 16-11-09 @Casual public class Hi extends Hello { public String sayHello(String name) { return &quot;Hi, &quot; + name; } } This second Hello bean is qualified @Casual
  • 137. Using a qualifier 16-11-09 public class Printer { @Inject @Casual Hello hello ; public void printHello() { System. out .println( hello .sayHello( &quot;Devoxx&quot; )); } } Injects the @Casual implementation of Hello
  • 138.
  • 139.
  • 140.
  • 141. 16-11-09 Validation Bean Validation integration, validating empty fields and multi-field validation with post-validate events
  • 142. 16-11-09 One model... ...validated across multiple layers Constraints in the enterprise User String username String email
  • 143.
  • 144. Defining constraints on the model 16-11-09 public class User { ... @NotNull @Size(min = 3, max = 25) public String getUsername() { return username ; } @NotNull @Email public String getEmail() { return email ; } }
  • 145. 16-11-09 One model... ...validated across multiple layers Constraints in JSF User String username String email
  • 146. Enforcing constraints in the UI 16-11-09 <h:inputText id = &quot;username&quot; value = &quot;#{user.username}&quot; /> <h:inputText id = &quot;email&quot; value = &quot;#{user.email}&quot; /> Zeroconf!
  • 147. Constraining partially 16-11-09 <h:inputText id = &quot;username&quot; value = &quot;#{user.username}&quot; > <f:validateBean disabled = &quot;true&quot; /> </h:inputText> <f:validateBean validationGroups = &quot;com.acme.BareMinimum&quot; > <h:inputText id = &quot;email&quot; value = &quot;#{user.email}&quot; /> </:validateBean>
  • 148.
  • 149.
  • 150.
  • 151. Listening for post validate 16-11-09 <h:form> <f:event type=&quot;postValidate&quot; listener=&quot;#{minMax.validate}&quot;/> <h:inputText id = &quot;min&quot; value = &quot;#{bean.min}&quot; binding = &quot;#{minMax.minInput}&quot; /> <h:inputText id = &quot;max&quot; value = &quot;#{bean.max}&quot; binding = &quot;#{minMax.maxInput}&quot; /> <h:commandButton value = &quot;Submit&quot; /> </h:form>
  • 152. Validating across fields 16-11-09 @Inject FacesContext ctx ; private UIInput minInput , maxInput ; // accessors hidden public void validate () { if ( ctx .isValidationFailed()) { return ; } if ((Integer) maxInput .getValue() < (Integer) minInput .getValue()) { ctx.addMessage( maxInput .getClientId(ctx), new FacesMessage( &quot;cannot be less than min value&quot; )); ctx.validationFailed() ; ctx.renderResponse(); } }
  • 153.
  • 154. 16-11-09 Error handling Exception handlers, exception events, servlet errors and the default error page
  • 155. 16-11-09 The good news No more swallowed exceptions!
  • 156. 16-11-09 The bad news You’re still going to get exceptions
  • 157.
  • 159.
  • 160.
  • 161. Declarative error handling in JSF 16-11-09 <exception class = &quot;javax.persistence.EntityNotFoundException&quot; > <redirect view-id = &quot;/error/404.xhtml&quot; > <message severity = &quot;warn&quot; > Record not found </message> </redirect> </exception> Wouldn’t it be nice if we had...? JSF 2.next
  • 162.
  • 163. 16-11-09 Pain relief Select items from collections, validation failed flag, API improvements, varStatus on ui:repeat, and more...
  • 164. From collection to select items 16-11-09 <h:selectOneMenu value = &quot;#{product.category}&quot; > <f:selectItems value = &quot; #{catalogBean.categories} &quot; var = &quot;cat&quot; itemLabel = &quot;#{cat.name}&quot; itemValue = &quot;#{cat}&quot; noSelectionValue = &quot;#{catalogBean.defaultCatalog}&quot; /> </h:selectOneMenu> @Named public class CatalogBean { public List<Category> getCategories() { return ...; } }
  • 165.
  • 166.
  • 167. 16-11-09 Community JSR-314-OPEN mailinglist, javaserverfaces-spec-public project, JCP.org and you !
  • 168.
  • 169.
  • 170. 16-11-09 Creating a JCP.org profile Did you know that anyone can have a JCP.org profile? Just sign up!
  • 171.
  • 172. 16-11-09 Becoming a JCP member Did you know that anyone can become a JCP member? Just sign the JSPA!
  • 173.
  • 174.
  • 175.
  • 176.
  • 177.

Hinweis der Redaktion

  1. We are going to have a great time this afternoon....because if the colors in that slide only get your fired up (or make your eyes bleed)....we&apos;ll, I don&apos;t know what&apos;s going to do it.In this talk we are going to be talking about progress. Specficially progress in JSF.Look, progress was a little bit of a stranger to JSF when the spec first opened. But it eventually found it&apos;s way and momentum has been steadily picking up right and plowed right through the final release of JSF 2. Now, there&apos;s been more active on the JSF development list since it became final than at any other point. We got a lot of what we wanted, but now we want more. (In fact, just creating this talk helped us identify areas for improvement). JSF 2 features were derived from community, precendent.
  2. The goals of this talk are to pull off on the side of the road and look at where we&apos;ve been, to explain the community&apos;s role in the making of JSF 2 and how you can help shape JSF 2.next and a glimpse at some of the things are in store for JSF 2.next. You may wonder what &amp;quot;.next&amp;quot; is all about. We&apos;ll, at this point we are really not sure whether the next version is JSF 2.1, 2.2 or some other version, or what JSR it&apos;s going to be under. But we are committed to seeing it happen, and with urgency. JSF 2.next also happens to be the issue tracker tag designated for future issues, so it&apos;s a bit of a play on that.
  3. The underlying theme of this talk is collaboration and community involved. (conference theme) So before we get into the talk, we want to enourage you to feel like you are a part of it right from the beginning. Expecting you guys to speak out in a forum like this is often wishful thinking. Instead, you can interact in a way familiar to a lot of you, using twitter. I&apos;ve selected the hashtag #jsf2next for you to make suggestions, ask questions or request clarification. At points during the talk, maybe not until the end, we&apos;ll parse this feedback and customize the content. That way, you&apos;ll really feel like your are involved. Even if we don&apos;t get to all the comments, it&apos;s a perfect starting point for tonight.
  4. So speaking of birds and feathers, there is a BOF tonight at 20:00 that will be the ideal break-out session to comlement this talk. So comment in twitter now, and if we don&apos;t get to it, then it&apos;s a conversation piece for tonight.I&apos;d like to take this opportunity to tell you who we are.
  5. Primary reason I am standing here today is because of what I wrote in Seam in Action; recognized where JSF could be improved (James Cobb, who came through in the clutch to put together some colors for us to use in code snippets)You&apos;ll notice that this is a joint talk because Oracle and Red Hat. Although we work for different organization, we are collegues on the JSR-314 EG. We are also members of the broader JSF community which we represent.But it&apos;s not just about our two organizations. We stand up hear representing the JSF EG. We feel a very strong alliance in this spec, one that you can certainly be proud of as community members. A lot of people have been involved in JSF; i&apos;ve done my best to identify the faces of JSF, past, present and future [Faces of JSF slide]
  6. We&apos;re going to break this talk up into parts, each of which one of us will be covering. Subconsciously, the topic areas sort of just fell into MVC, which is the foundation pattern of JSF. Also nicely breaks down between two halfs of this talk. First half, point, second half point. We&apos;ll do a short break in between to let you stretch your legs and brains (and to get in a few tweets).
  7. Let&apos;s get on with it, shall we. I&apos;ll now turn the floor over to Andy, who is going to show you how slick the view creation has become, complete with Ajax, JavaScript APIs and powerful templating.
  8. Point is, no special tricks
  9. PreRenderView event loop
  10. Serve resource files natively out of a Java archive
  11. * Emphsize the web profile - lightweight, aimed at developing “web” apps
  12. * We can improve on the syntax for this! f.e. make faces messages easier to add, add some syntatic sugar i.e. consider this an idea, not the canonical way to do it
  13. * Discuss JSF design flaw - exceptions for flow control!