@Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    setAttributes(renderRequest);

    long roleId = ParamUtil.getLong(renderRequest, "roleId");

    if (SessionErrors.contains(renderRequest, RequiredRoleException.class.getName())
        && (roleId < 1)) {

      include("/view.jsp", renderRequest, renderResponse);
    } else if (SessionErrors.contains(renderRequest, DuplicateRoleException.class.getName())
        || SessionErrors.contains(renderRequest, RequiredRoleException.class.getName())
        || SessionErrors.contains(renderRequest, RoleNameException.class.getName())) {

      include("/edit_role.jsp", renderRequest, renderResponse);
    } else if (SessionErrors.contains(renderRequest, NoSuchRoleException.class.getName())
        || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())
        || SessionErrors.contains(renderRequest, RoleAssignmentException.class.getName())
        || SessionErrors.contains(renderRequest, RolePermissionsException.class.getName())) {

      include("/error.jsp", renderRequest, renderResponse);
    } else {
      super.doDispatch(renderRequest, renderResponse);
    }
  }
  @Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    if (SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())
        || SessionErrors.contains(renderRequest, WorkflowException.class.getName())) {

      hideDefaultErrorMessage(renderRequest);

      include("/error.jsp", renderRequest, renderResponse);
    } else {
      super.doDispatch(renderRequest, renderResponse);
    }
  }
  @Override
  protected void doDispatch(RenderRequest renderRequest, RenderResponse renderResponse)
      throws IOException, PortletException {

    if (SessionErrors.contains(renderRequest, NoSuchArticleException.class.getName())
        || SessionErrors.contains(renderRequest, NoSuchFeedException.class.getName())
        || SessionErrors.contains(renderRequest, NoSuchFolderException.class.getName())
        || SessionErrors.contains(renderRequest, NoSuchStructureException.class.getName())
        || SessionErrors.contains(renderRequest, NoSuchTemplateException.class.getName())
        || SessionErrors.contains(renderRequest, PrincipalException.getNestedClasses())) {

      include("/portlet/journal/html/error.jsp", renderRequest, renderResponse);
    } else {
      super.doDispatch(renderRequest, renderResponse);
    }
  }