Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Anand Raman
Challenges of integrating a JSF application with Liferay Portal
December 7, 2012 7:10 AM
Answer

Anand Raman

Rank: New Member

Posts: 8

Join Date: November 22, 2012

Recent Posts

Good day,

We are planning to develop our application using JSF and then integrate it into Liferay using the Liferay Faces Bridge. We would typically perform the integration at the end of each release cycle. What are the typical challenges that can come up during integration?

Best regards,
Anand
Neil Griffin
RE: Challenges of integrating a JSF application with Liferay Portal
December 7, 2012 8:08 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2054

Join Date: July 26, 2005

Recent Posts

When developing your JSF web application, be sure to avoid any casts to HttpServletRequest, HttpServletResponse, etc. Instead, use the methods on ExternalContext(). For example:

 1FacesContext facesContext = FacesContext.getCurrentInstance();
 2ExternalContext externalContext = facesContext.getExternalContext();
 3
 4// Incompatible with portlets
 5HttpServletRequest request = (HttpServletRequest) externalContext.getRequest();
 6String attributeValue = (String) request.getAttribute("foo");
 7String parameterValue = request.getParameter("bar");
 8
 9// Compatibile with both webapps and portlets:
10String attributeValue = (String) externalContext.getRequestMap().get("foo");
11String parameterVale = externalContext.getRequestParameterMap().get("bar");


By following this type of approach, you will increase your chances that your JSF web application will be deployable as a portlet during your integration phase.