Content management system 正在将根页面的页面属性提取到/apps/sling/servlet/errorhandler/Throwable.jsp

Content management system 正在将根页面的页面属性提取到/apps/sling/servlet/errorhandler/Throwable.jsp,content-management-system,adobe,aem,Content Management System,Adobe,Aem,我有一个简单的用例,如下所示: AEM中抛出一个500错误 最终用户被重定向到/apps/sling/servlet/errorhandler/Throwable.jsp,其中包含500错误页面的位置 如果我设置,它工作正常 然而,我想做的是,在页面属性高级选项卡中创建一个pathfield,以便作者可以在根页面设置错误500页面 以便: 如果在:/content/sitename/en/home/products/myproduct.html上抛出500错误 错误500页属性设置在:/cont

我有一个简单的用例,如下所示:

  • AEM中抛出一个500错误
  • 最终用户被重定向到/apps/sling/servlet/errorhandler/Throwable.jsp,其中包含500错误页面的位置
  • 如果我设置,它工作正常
  • 然而,我想做的是,在页面属性高级选项卡中创建一个pathfield,以便作者可以在根页面设置错误500页面

    以便:

    如果在:/content/sitename/en/home/products/myproduct.html上抛出500错误 错误500页属性设置在:/content/sitename/en/ 错误500页面位于/content/sitename/en/home/errors/500.jsp

    CQ应该自下而上搜索页面树结构,从错误抛出的位置到设置错误500页面的位置,然后在找到错误处理程序集的第一个属性时,通过/apps/sling/servlet/errorhandler/Throwable.jsp将其重定向到该500页面

    因此,在/apps/sling/servlet/errorhandler/Throwable.jsp中,完整的代码是:

        <%@page session="false"
          import="com.day.cq.wcm.commons.WCMUtils"
          import="org.apache.sling.api.resource.Resource"
          import="javax.jcr.Node"
          %>
          <%
         %><%@include file="/libs/foundation/global.jsp" %>
    
         <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    
         <%
              String errorPage= WCMUtils.getInheritedProperty(currentPage,    resourceResolver, "errorrPageRedirect");
           %>
    
          <c:redirect url="${errorPage}"/>
    
    
            Doesn't seems to be working. Am I missing something ?
    
    
    似乎不起作用。我错过什么了吗?
    
    你看过吗

    您甚至可以为不同的路径指定不同的404页。我不记得错误页面相对于路径的位置是否有限制,但它符合您的要求