On Oct 8, 2008, at 8:39 PM, pradeep reddy wrote:

Thanks Taylor,

I am using JSF portlets in my application.
So in the examples you referred, UserManager is accessed through portletcontext object.

Is there any way to access the portletcontext object through JSF externalcontext?


userManager = (UserManager) getPortletContext().getAttribute( CommonPortletServices.CPS_USER_MANAGER_COMPONENT);Regards,
Pradeep.

Here is an example from the j2-admin application in the 2.1.3 source:

public class ProfilerAdminPortlet extends FacesPortlet
{
    UserManager userManager;

    public void init(PortletConfig config) throws PortletException
    {
        super.init(config);
        userManager = (UserManager) getPortletContext().getAttribute(
                CommonPortletServices.CPS_USER_MANAGER_COMPONENT);
        if (null == userManager)
        {
throw new PortletException("Failed to find the User Manager on portlet initialization");
        }
    }

...
in your JSF bean
...

    public void listen(ActionEvent event)
    {
Map appMap = FacesContext .getCurrentInstance().getExternalContext().getApplicationMap(); userManager = (Profiler)appMap.get(CommonPortletServices.CPS_USER_MANAGER_COMPONENT);


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to