Currently selected page in WebSphere Portal

News Site news RSS

Latest articles New articles RSS

Latest news from Twitter Follow Secretkeeper4 and www.svesoftware.com on Twitter

Currently selected page in WebSphere Portal

If you need to find out which page are you on currently, one have to spend a lot of time on google or reading Portal SPI and extracting different jar files all over the installation folder.

WebSphere Portal 7 contains portal session object 'wp' which contains different functions and data. Everything what is contained within this object can be examined by decompiling several classess, since official documentation doesn't exist.

However, from Portlet (JSR286) jsp file, since it has access to HttpServletSession, or portal session, you can write something like this:

 

<c:set var="selectedurl" scope="request" value="${wp.selectionModel.selected.metadata['com.ibm.portal.friendly.name']}" />
 
Variable 'selectedurlnow contains friendly name of current navigation node.
This is far more simple then instantiating a lot of portal services and of writing java scriptlets within jsp which is ugly.
 
Other example:
 
<c:out value="${wp.user['displayName']}" />
 
Very nice.