Bobby Rosenberger <[EMAIL PROTECTED]> wrote on 11/18/2005 11:57:28 AM:

> Hey guys,
>
> I would like to access a session scoped backingbean ("user") from an
> actionListener... I'm currently doing something along the lines of:
>
> FacesContext context = FacesContext.getCurrentInstance();
> HttpServletRequest request = (HttpServletRequest)context.
> getExternalContext().getRequest();
> HttpSession session = request.getSession();
> UserBean user = (UserBean)session.getAttribute("user");
>
> Is there a better way?


If you use Shale, (and if your backing bean extends AbstractViewController), then I believe you can simply say getBean("user");

>
> Thanks,
>
> Bobby Rosenberger
>


Regards,
Geeta

Reply via email to