2010-07-22

@Named vs. @ManagedBean in JSF 2.0

A lot of people seem to suggest that you should use @Named instead of @ManagedBean in JSF 2.0 (e.g. see @ManagedBean dead on arrival? or this JavaRanch discussion).

However, what I discovered in a painful process is that you must use @ManagedBean when the scope is @ViewScoped, apparently because CDI doesn’t declare a view scope. Thus this is correct:

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean
@ViewScoped
public class DogsBean {
// ...

NOTE: I am using JBoss 6 M3.

6 comments:

  1. Another thing I've noticed (although it might just be a problem on my end as I'm new to JSF) is that ajax-induced valueChangeHandlers will work with ManagedBeans but not @Named resources.

    ReplyDelete
  2. I really can't wait to seeing this Dying to Read post and of course as always I have to give credit to the lovely Jill over at Breaking the Spine, which is so inspires me a lot as well. But there are also very beneficial human resources assignment help is always here to giving you their best services in all over the UK respectively.

    ReplyDelete
  3. This is an amazing, I truly can't wait to visit this Dying to Read post and of study, as ever I keep giving glory to the beautiful Jill over at Cracking the Spine, which encourages me a lot as well I know best wiki writers for hire. they gives unbelievable services all over the US.

    ReplyDelete
  4. I have noticed some writing issues in this post which can only be corrected by expert online book ghostwriters. By the way, I am really excited to read this Dying to Read post. As usual, I must give credit to the lovely work of these writers at breaking the spine, as her work greatly inspires me.

    ReplyDelete
  5. Do you find it difficult to articulate your thoughts? Our ghostwriting services can assist in realizing your idea through expertly written content that flawlessly expresses your voice!

    ReplyDelete
  6. Heavy equipment auctions in Texas are excellent opportunities for buyers and sellers of industrial machinery to connect. These auctions often feature a wide range of equipment, from construction machinery like excavators, bulldozers, and loaders to agricultural tractors, trucks, and trailers. Auction events can be held on-site or online, providing flexibility for local and remote buyers.

    Major Texas cities like Houston, Dallas, and San Antonio frequently host large auctions, attracting bidders from across the state and beyond. Additionally, these auctions often feature a wide array of brands and models, providing buyers with ample choices to meet their specific operational needs while ensuring sellers can reach a broad audience of potential buyers.

    ReplyDelete