I was answering a query on the uPortal mailing list. It was concerning how to access portlet variables using a tag library, JSTL being the obvious choice for this.
What follows is my response to the original query; does it make sense? Is this what PortletRequestWrapper is for? How else would you access variables in portlet request scope etc. without resorting to scriptlets? The <portlet:defineObjects/> from the portlet taglib will create renderRequest, renderResponse and portletConfig objects in the request and page scopes for use in your JSP. You should be able to access these objects using JSTL. Therefore something like this should work: <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> <portlet:defineObjects/> ServerName : <c:out value="${renderRequest.serverName}"/><br /> ServerPort : <c:out value="${renderRequest.serverPort}"/><br /> This only takes you so far, I'm not sure you can access portlet scoped attributes this way. As I understand it, in JSTL application variables such as the various scopes are mapped to implicit objects so that javax.servlet.http.HttpServletRequest is mapped to org.apache.taglibs.standard.lang.jstl.ImplicitObjects. In JSTL this enables easy access to standard HTTP scoped variables without scriptlets. As far as I know there is no such implicit object mapping arrangement for the portlet variables as yet. I haven't tried the following approach yet myself but it _might_ work! The usual MVC style of things is to populate a java bean (or beans) prior to the JSP view page, store these beans in the appropriate scope and then in the JSP page access the various variables from the beans. In order to pass your bean/map into a portlet JSP page you could extend a PortletRequestWrapper to include additional methods to do things like create, populate and return a map of your variables. In your portlet code you would then pass the PortletRequestWrapper in the include method of the invoking PortletRequestDispatcher. Now you should be able to access your variables from the wrapped portlet request object using JSTL. At no point are you directly accessing the underlying HTTP session, request or context so this should be good portlet practice. Mark
