My JSF Books/Videos My JSF Tutorials OmniFaces/JSF PPTs
JSF 2.3 Tutorial
JSF Caching Tutorial
JSF Navigation Tutorial
JSF Scopes Tutorial
JSF Page Author Beginner's Guide
OmniFaces 2.3 Tutorial Examples
OmniFaces 2.2 Tutorial Examples
JSF Events Tutorial
OmniFaces Callbacks Usages
JSF State Tutorial
JSF and Design Patterns
JSF 2.3 New Features (2.3-m04)
Introduction to OmniFaces
25+ Reasons to use OmniFaces in JSF
OmniFaces Validators
OmniFaces Converters
JSF Design Patterns
Mastering OmniFaces
Reusable and less-verbose JSF code

My JSF Resources ...

Java EE Guardian
Member of JCG Program
Member MVB DZone
Blog curated on ZEEF
OmniFaces is an utility library for JSF, including PrimeFaces, RichFaces, ICEfaces ...

.

.

.

.

.

.

.

.


[OmniFaces Utilities] - Find the right JSF OmniFaces 2 utilities methods/functions

Search on blog

Petition by Java EE Guardians

Twitter

luni, 7 noiembrie 2016

JSF 2.3 comes with @ManagedProperty compatible with CDI

The JSF managed bean annotations will be deprecated in JSF 2.3. This includes @ManagedProperty as well. But, compared to other annotations, this one has got an implementation that can be used with CDI managed beans. So, in CDI managed beans we can use the new, javax.faces.annotation.ManagedProperty. Let's see an example of injecting an instance of SourceBean into TargetBean, and a property of SourceBean into TargetBean:

@Named
@RequestScoped
public class SourceBean {

 private String source;
   
 @PostConstruct
 public void init(){
  source = "SourceBean";
 }

 public String getSource() {
  return source;
 }

 public void setSource(String source) {
  this.source = source;
 }       
}

import javax.faces.annotation.ManagedProperty;
...
@Named
@RequestScoped
public class TargetBean {

 @Inject @ManagedProperty("#{sourceBean}")
 private SourceBean sourceBean;
   
 @Inject @ManagedProperty("#{sourceBean.source}")
 private String source;
   
 public void targetAction(){
  System.out.println("Injected bean: " + sourceBean);
  System.out.println("Injected property (via injected bean): " + sourceBean.getSource());
  System.out.println("Injected property: " + source);
 }
}

The complete example is available here.

duminică, 6 noiembrie 2016

JSF BOOKS COLLECTION

Postări populare

Visitors Starting 4 September 2015

Locations of Site Visitors