Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Liferay portlet: Passing attributes to JSP
public class CustomPortlet extends MVCPortlet {
public void doView(RenderRequest renderRequest, RenderResponse renderResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
User currentUser = themeDisplay.getUser();
renderRequest.setAttribute("currentFirstName", currentUser.getFirstName());
// Add attributes as required
super.doView(renderRequest, renderResponse);
<%@ taglib uri="" prefix="portlet" %>
<portlet:defineObjects />
<div> Your first name is: <%= request.getAttribute("currentFirstName"); %> </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.