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.

3 comentarii :

  1. cobalt vs titanium drill bits, 3-axis, 3-axis, 3-axis
    In the case 2013 ford focus titanium hatchback of a Model 2 Model titanium bike frame 2 Genesis with only 3rd degree titanium gold performance and 4-axis VR chi titanium flat iron Headset (the titanium rod latter has a dual-axis

    RăspundețiȘtergere
  2. True, People search for tech app developers near me, various options available to you will depend on your budget, the kind of project you have, and the type of services or skills you require. Eiliana.com is a global freelancing portal where you can hire app developers near me by filtering the location.

    RăspundețiȘtergere

JSF BOOKS COLLECTION

Postări populare

Visitors Starting 4 September 2015

Locations of Site Visitors