title: How to obtain page's organization in liferay portlet?
body: <p>How to obtain page's organization in liferay portlet correctly?</p>
  
  <p>I tried: </p>
  
  <p>Company. Is not an organization, but a portal instance.</p>
  
  <p>Group. Is group of current user, not of current page.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I am in the portlet class' <code>doView</code> method. I know how to pass anything I can obtain here upwards to JSP to be accessible via <code>EL/JSTL</code>.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p><code>group.getOrganizationId()</code> always returns zero.</p>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>This code I use to prepare variables</p>
  
  <pre><code>private void storeVariables(RenderRequest renderRequest) {
  
      PortletPreferences prefs = renderRequest.getPreferences();
      String image_id = (String) prefs.getValue("image_id", "communicator");
  
      ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
  
      Company company = themeDisplay.getCompany();
  
      Group group = themeDisplay.getScopeGroup();
      log.info("group = {}", group);
  
      long organizationId = group.getOrganizationId();
      log.info("organizationId = {}", organizationId);
  
      PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
  
  
      String contextPath = renderRequest.getContextPath();
      if( !contextPath.endsWith("/") ) {
          contextPath = contextPath + "/";
      }
  
      renderRequest.setAttribute("images", images);
      renderRequest.setAttribute("image", images.get(image_id));
      renderRequest.setAttribute("image_id", image_id);
      renderRequest.setAttribute("themeDisplay", themeDisplay);
      renderRequest.setAttribute("portletDisplay", portletDisplay);
      renderRequest.setAttribute("contextPath", contextPath);
  
  
  }
  </code></pre>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>The following code in JSP returns empty string</p>
  
  <pre><code>&lt;!-- scopeGroupId = &lt;c:out value="${scopeGroupId}"/&gt; --&gt;
  </code></pre>