Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getting PortletSession in JSF  RSS feed

sujith Acharya
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have a requirement to set an attribute in PortletSession in JSF portlet.
How can I get portletSession instance in PageCodeBase ?
I tried,
PortletRequest portletRequest=(PortletRequest)getFacesContext().getExternalContext().getRequest();
PortletSession session = portletRequest.getPortletSession();

In this line : portletRequest=(PortletRequest)getFacesContext().getExternalContext().getRequest();
But the Object we are getting here can not be Type casted to Portlet request. So its throwing exception.

Is there any alternative to get PortletSession in in PageCodeBase?

-Thanks in advance
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!