File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes getting the name of the managed bean which is going to be executed by the UI component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "getting the name of the managed bean which is going to be executed by the UI component" Watch "getting the name of the managed bean which is going to be executed by the UI component" New topic
Author

getting the name of the managed bean which is going to be executed by the UI component

khaja syed
Greenhorn

Joined: Oct 30, 2012
Posts: 3
Hi,
I want to get the managed bean name in the PhaseListener implementation class.For example if i am using a button component to invoke the managed bean, i need to get the name of that bean in any of the phases.I have 10 managed bean classes in my project.
Please ,can anyone help me out in resolving this requirement.


Thank you.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

Any given View can reference dozens (no limit) of Managed Beans. So getting "the" name of "the" managed bean is a meaningless concept.

Aside from that, you don't "execute" beans. You execute (invoke) methods. A bean can contain multiple methods.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bhargavan Marepalli
Greenhorn

Joined: Jun 25, 2011
Posts: 15

@ Tim I think khaja was not able to express his requirement in a clear way..I hope this may be his need. Infact i have the same doubt..Let me put that

A user is Logged in and performed some actions..(Filled some form data,submitted it,viewed some links on the page and done some more actions..) and logged out..

In his particular session, some managed beans will be created and

can we get which beans are created(first time) and how many times that beans are hitted (to invoke a method or any other setting/getting values etc..) in his particular session..Is there any way of recording this in any PhaseListener or some Other thing.

Thanks,

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

Actually, this sounds like one of those common situations where someone has decided on a specific low-level solution to a high-level problem. Very frequently in cases like this, if we know what the high-level problem (business case) is, we can suggest a simpler, cleaner solution.

JSF is especially prone to this syndrome because the typical programmer mindset when given a complex framework is supplied is to attempt to maximize the use of the framework-specific functions. However, JSF was designed with the goal in mind that as much functionality as possible should be using POJO techniques. That is why my cardinal rule in JSF is to always think twice before utilising anything from a javax.faces package that isn't one of the model classes. Most of the JSF functions are intended to work from the outside in (Inversion of Control) instead of the inside out.
 
 
subject: getting the name of the managed bean which is going to be executed by the UI component
 
Similar Threads
managed bean injection problem
How get session mb in POJO?
Creating List/Array of Managed Beans
Query string in jsf
Can't find managed bean in xhtml attribute values..!