Foros de discusión
Replacement for JSFPortletUtil?
Bob Dietrich, modificado hace 9 años.
Replacement for JSFPortletUtil?
Regular Member Mensajes: 221 Fecha de incorporación: 16/05/05 Mensajes recientes
In 6.1 and some earlier versions of Liferay, there was a class called JSFPortletUtil in util-bridges.jar. I used this to retrieve the PortletPreferences for my portlet.
In 6.2GA2 (haven't checked GA1), the class has disappeared. Not deprecated, simply removed.
How should portlet preferences be retrieved in 6.2? Thanks.
In 6.2GA2 (haven't checked GA1), the class has disappeared. Not deprecated, simply removed.
How should portlet preferences be retrieved in 6.2? Thanks.
David H Nebinger, modificado hace 9 años.
RE: Replacement for JSFPortletUtil? (Respuesta)
Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
You can always do it the old fashioned way, use the ExternalContext to get the request and then access the portlet prefs that way...
Bob Dietrich, modificado hace 9 años.
RE: Replacement for JSFPortletUtil? (Respuesta)
Regular Member Mensajes: 221 Fecha de incorporación: 16/05/05 Mensajes recientes
Yeah, I guess that's an option I'd forgotten about:
Thanks.
PortletRequest req = (PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
PortletPreferences prefs = req.getPreferences();
orPortletRequest req = LiferayFacesContext.getInstance().getPortletRequest();
PortletPreferences prefs = req.getPreferences();
Thanks.
Kashif Ayyaz Haider, modificado hace 9 años.
RE: Replacement for JSFPortletUtil?
Junior Member Mensajes: 35 Fecha de incorporación: 16/03/13 Mensajes recientes
very true,
in my case this worked
//PortletRequest portletRequest = (PortletRequest) JSFPortletUtil.getPortletRequest(FacesContext.getCurrentInstance());
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
PortletRequest portletRequest = (PortletRequest) externalContext.getRequest();
in my case this worked
//PortletRequest portletRequest = (PortletRequest) JSFPortletUtil.getPortletRequest(FacesContext.getCurrentInstance());
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
PortletRequest portletRequest = (PortletRequest) externalContext.getRequest();
Christophe Noel, modificado hace 8 años.
RE: Replacement for JSFPortletUtil?
Junior Member Mensajes: 99 Fecha de incorporación: 28/09/12 Mensajes recientes
More easy now:
LiferayFacesContext.getInstance().getPortletPreferences();