Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-85210

ErrorTag does not find SessionErrors added by Struts actions or Filters

    Details

    • Fix Priority:
      1

      Description

      When calling SessionErrors.add(HttpServletRequest, ...) the error keys are set into the portal session without any portlet / layout (etc.) prefix. This is the only option when doing so from Struts actions or Filters where there is no PortletRequest. In many cases such actions/filters will issue a HTTP redirect to a MVCRenderCommand, resulting in the rendering of a JSP containing <liferay-ui:error/> tags.

      Unfortunately in such scenarios the tag will not find the error, because it looks it up with the portlet RenderRequest which applies a prefix to the error key.

      It is possible to work around this by using code like the following, but then the error message icon/styling is incorrect and must be manually added.

       

      <c:if test="<%= SessionErrors.contains(request, SomeException.class) %>">
        <div class="alert alert-danger">
          <liferay-ui:message key="some-language-key" />
        </div>
      </c:if>
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                support-lep@liferay.com SE Support
                Reporter:
                id30721 id30721
                Participants of an Issue:
                Recent user:
                Sherry Zhu
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  1 year, 10 weeks, 3 days ago

                  Packages

                  Version Package