[ofbiz-framework] branch release17.12 updated: Improved: Improve error message page to support Theming (OFBIZ-10753)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch release17.12 updated: Improved: Improve error message page to support Theming (OFBIZ-10753)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 9b9db9e  Improved: Improve error message page to support Theming (OFBIZ-10753)
9b9db9e is described below

commit 9b9db9e5111dc5bdf3c3a2fed39e81563343d7ef
Author: Nicolas Malin <[hidden email]>
AuthorDate: Mon Mar 25 09:31:02 2019 +0000

    Improved: Improve error message page to support Theming
    (OFBIZ-10753)
   
    When OFBiz raise an error, the framework use a jsp page to display it.
    I improved the error page generation to support also ftl template rendering and by this way extend the theme engine to support to overide it
   
    On controler.xml we can now use :
        <errorpage>/error/error.jsp</errorpage>
    or
        <errorpage>component://common/webcommon/error/Error.ftl</errorpage> (default configuration)
   
    On your theme you can add your own error page :
        <template>
          ...
          <template-file widget=menu location=component://common-theme/template/macro/HtmlMenuMacroLibrary.ftl/>
        + <template-file widget=error location=component://common-theme/template/ErrorPage.ftl/>
        </template>
   
    The component://common/webcommon/error/Error.ftl contains the logic theming connection and to simplify source code, all framework old error page (error.jsp) have been removed to centralize all on this new page.
   
    Thanks to Marine Desmarchelier for the error page design
   
    git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1856175 13f79535-47bb-0310-9956-ffa450edef68
   
    # Conflicts:
    # framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java
    # themes/common/template/ErrorPage.ftl
---
 .../accounting/webapp/accounting/error/error.jsp   | 52 -------------
 applications/accounting/webapp/ap/error/error.jsp  | 52 -------------
 applications/accounting/webapp/ar/error/error.jsp  | 52 -------------
 .../commonext/webapp/ofbizsetup/error/error.jsp    | 52 -------------
 .../content/webapp/content/error/error.jsp         | 52 -------------
 .../humanres/webapp/humanres/error/error.jsp       | 52 -------------
 .../webapp/manufacturing/error/error.jsp           | 52 -------------
 .../marketing/webapp/marketing/error/error.jsp     | 53 -------------
 applications/marketing/webapp/sfa/error/error.jsp  | 53 -------------
 applications/order/webapp/ordermgr/error/error.jsp | 52 -------------
 applications/party/webapp/partymgr/error/error.jsp | 53 -------------
 .../product/webapp/catalog/error/error.jsp         | 53 -------------
 .../product/webapp/facility/error/error.jsp        | 53 -------------
 .../workeffort/webapp/workeffort/error/error.jsp   | 53 -------------
 .../common/webcommon/WEB-INF/common-controller.xml |  2 +-
 framework/common/webcommon/error/Error.ftl         | 42 +++++++++++
 framework/resources/templates/error.jsp            | 53 -------------
 .../ofbiz/webapp/control/ControlServlet.java       | 86 +++++++++++++++-------
 .../ofbiz/webapp/control/RequestHandler.java       | 15 ++--
 framework/webtools/webapp/webtools/error/error.jsp | 52 -------------
 framework/widget/dtd/widget-theme.xsd              |  3 +-
 .../org/apache/ofbiz/widget/model/ModelTheme.java  | 17 +++++
 themes/common/widget/Theme.xml                     |  1 +
 23 files changed, 131 insertions(+), 874 deletions(-)

diff --git a/applications/accounting/webapp/accounting/error/error.jsp b/applications/accounting/webapp/accounting/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/accounting/webapp/accounting/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/accounting/webapp/ap/error/error.jsp b/applications/accounting/webapp/ap/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/accounting/webapp/ap/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/accounting/webapp/ar/error/error.jsp b/applications/accounting/webapp/ar/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/accounting/webapp/ar/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/commonext/webapp/ofbizsetup/error/error.jsp b/applications/commonext/webapp/ofbizsetup/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/commonext/webapp/ofbizsetup/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/content/webapp/content/error/error.jsp b/applications/content/webapp/content/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/content/webapp/content/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/humanres/webapp/humanres/error/error.jsp b/applications/humanres/webapp/humanres/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/humanres/webapp/humanres/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/manufacturing/webapp/manufacturing/error/error.jsp b/applications/manufacturing/webapp/manufacturing/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/manufacturing/webapp/manufacturing/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/marketing/webapp/marketing/error/error.jsp b/applications/marketing/webapp/marketing/error/error.jsp
deleted file mode 100644
index 83f0147..0000000
--- a/applications/marketing/webapp/marketing/error/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/marketing/webapp/sfa/error/error.jsp b/applications/marketing/webapp/sfa/error/error.jsp
deleted file mode 100644
index 83f0147..0000000
--- a/applications/marketing/webapp/sfa/error/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/order/webapp/ordermgr/error/error.jsp b/applications/order/webapp/ordermgr/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/applications/order/webapp/ordermgr/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/party/webapp/partymgr/error/error.jsp b/applications/party/webapp/partymgr/error/error.jsp
deleted file mode 100644
index 83f0147..0000000
--- a/applications/party/webapp/partymgr/error/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/product/webapp/catalog/error/error.jsp b/applications/product/webapp/catalog/error/error.jsp
deleted file mode 100644
index 83f0147..0000000
--- a/applications/product/webapp/catalog/error/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/product/webapp/facility/error/error.jsp b/applications/product/webapp/facility/error/error.jsp
deleted file mode 100644
index 83f0147..0000000
--- a/applications/product/webapp/facility/error/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/applications/workeffort/webapp/workeffort/error/error.jsp b/applications/workeffort/webapp/workeffort/error/error.jsp
deleted file mode 100644
index 83f0147..0000000
--- a/applications/workeffort/webapp/workeffort/error/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/framework/common/webcommon/WEB-INF/common-controller.xml b/framework/common/webcommon/WEB-INF/common-controller.xml
index d0f6717..57e0b9a 100644
--- a/framework/common/webcommon/WEB-INF/common-controller.xml
+++ b/framework/common/webcommon/WEB-INF/common-controller.xml
@@ -23,7 +23,7 @@ under the License.
     <include location="component://common/webcommon/WEB-INF/handlers-controller.xml"/>
     <description>Common ControlServlet Configuration File</description>
 
-    <errorpage>/error/error.jsp</errorpage>
+    <errorpage>component://common/webcommon/error/Error.ftl</errorpage>
 
     <preprocessor>
         <!-- Events to run on every request before security (chains exempt) -->
diff --git a/framework/common/webcommon/error/Error.ftl b/framework/common/webcommon/error/Error.ftl
new file mode 100644
index 0000000..6090bc7
--- /dev/null
+++ b/framework/common/webcommon/error/Error.ftl
@@ -0,0 +1,42 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<#if !visualTheme?has_content>
+    <#-- Try to resolve the default theme-->
+    <#assign visualTheme = Static["org.apache.ofbiz.widget.model.ThemeFactory"].resolveVisualTheme(null)/>
+</#if>
+<#if visualTheme?has_content>
+    <#assign errorPageLocation = visualTheme.modelTheme.getErrorTemplateLocation('screen')/>
+</#if>
+<#if errorPageLocation?has_content>
+    <#include visualTheme.modelTheme.getErrorTemplateLocation('screen')/>
+<#else>
+<#-- Not error page found to we use a raw output -->
+<html>
+<head>
+    <title>OFBiz Message</title><meta http-equiv="Content-Type" content="text/html">
+</head>
+<body bgcolor="#FFFFFF">
+<div align="center">
+    <h1>ERROR MESSAGE</h1>
+    <hr>
+    <p>${request.getAttribute('_ERROR_MESSAGE_')?replace("\n", "<br/>")}</p>
+</div>
+</body>
+</html>
+</#if>
\ No newline at end of file
diff --git a/framework/resources/templates/error.jsp b/framework/resources/templates/error.jsp
deleted file mode 100644
index adcf72b..0000000
--- a/framework/resources/templates/error.jsp
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
\ No newline at end of file
diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java
index d552473..7ffa93b 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java
@@ -18,9 +18,12 @@
  *******************************************************************************/
 package org.apache.ofbiz.webapp.control;
 
+import freemarker.template.Template;
 import java.io.IOException;
 import java.util.Enumeration;
 
+import java.util.HashMap;
+import java.util.Map;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -31,6 +34,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
 import org.apache.ofbiz.base.util.Debug;
+import org.apache.ofbiz.base.util.StringUtil;
 import org.apache.ofbiz.base.util.UtilCodec;
 import org.apache.ofbiz.base.util.UtilGenerics;
 import org.apache.ofbiz.base.util.UtilHttp;
@@ -239,41 +243,67 @@ public class ControlServlet extends HttpServlet {
         if (errorPage != null) {
             Debug.logError("An error occurred, going to the errorPage: " + errorPage, module);
 
-            RequestDispatcher rd = request.getRequestDispatcher(errorPage);
+            Map<String, Object> context = new HashMap<>();
+            context.put("request", request);
+            context.put("response", response);
+            context.put("session", session);
+            context.put("dispatcher", dispatcher);
+            context.put("delegator", delegator);
+            context.put("security", security);
+            context.put("locale", UtilHttp.getLocale(request));
+            context.put("timeZone", UtilHttp.getTimeZone(request));
+            context.put("userLogin", session.getAttribute("userLogin"));
+            context.put("visualTheme", UtilHttp.getVisualTheme(request));
+
+            boolean errorPageFailed = false;
+            if (errorPage.endsWith(".jsp")) {
+                RequestDispatcher rd = request.getRequestDispatcher(errorPage);
+
+                // use this request parameter to avoid infinite looping on errors in the error page...
+                if (request.getAttribute("_ERROR_OCCURRED_") == null && rd != null) {
+                    request.setAttribute("_ERROR_OCCURRED_", Boolean.TRUE);
+                    Debug.logError("Including errorPage: " + errorPage, module);
 
-            // use this request parameter to avoid infinite looping on errors in the error page...
-            if (request.getAttribute("_ERROR_OCCURRED_") == null && rd != null) {
-                request.setAttribute("_ERROR_OCCURRED_", Boolean.TRUE);
-                Debug.logError("Including errorPage: " + errorPage, module);
-
-                // NOTE DEJ20070727 after having trouble with all of these, try to get the page out and as a last resort just send something back
+                    try {
+                        rd.include(request, response);
+                    } catch (Throwable t) {
+                        errorPageFailed = true;
+                    }
+                } else {
+                    if (rd == null) {
+                        Debug.logError("Could not get RequestDispatcher for errorPage: " + errorPage, module);
+                    }
+                    errorPageFailed = true;
+                }
+            } else {
+                try {
+                    Template template = FreeMarkerWorker.getTemplate(errorPage);
+                    FreeMarkerWorker.renderTemplate(template, context, response.getWriter());
+                } catch (Exception e) {
+                    errorPageFailed = true;
+                }
+            }
+            if (errorPageFailed) {
+                StringBuilder errorMessage = new StringBuilder("<html><body>")
+                        .append("<h1>ERROR MESSAGE</h1>")
+                        .append("<hr>").append("<p>")
+                        .append("ERROR in error page, (infinite loop or error page not found with name ")
+                        .append("[").append(errorPage).append("]").append("</p><p>")
+                        .append("Original error detected, maybe it would be helps you : ")
+                        .append(StringUtil.replaceString((String) request.getAttribute("_ERROR_MESSAGE_"), "\n", "<br>"))
+                        .append("</p></body></html>");
                 try {
-                    rd.include(request, response);
+                    response.getWriter().print(errorMessage.toString());
                 } catch (Throwable t) {
-                    Debug.logWarning("Error while trying to send error page using rd.include (will try response.getOutputStream or response.getWriter): " + t.toString(), module);
-
-                    String errorMessage = "ERROR rendering error page [" + errorPage + "], but here is the error text: " + request.getAttribute("_ERROR_MESSAGE_");
                     try {
-                        response.getWriter().print(errorMessage);
+                        int errorToSend = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+                        Debug.logWarning("Error while trying to write error message using response.getOutputStream or response.getWriter, sending error code [" + errorToSend + "], and message [" + errorMessage + "]", module);
+                        response.sendError(errorToSend, errorMessage.toString());
                     } catch (Throwable t2) {
-                        try {
-                            int errorToSend = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
-                            Debug.logWarning("Error while trying to write error message using response.getOutputStream or response.getWriter: " + t.toString() + "; sending error code [" + errorToSend + "], and message [" + errorMessage + "]", module);
-                            response.sendError(errorToSend, errorMessage);
-                        } catch (Throwable t3) {
-                            // wow, still bad... just throw an IllegalStateException with the message and let the servlet container handle it
-                            throw new IllegalStateException(errorMessage);
-                        }
+                        // wow, still bad... just throw an IllegalStateException with the message and let the servlet container handle it
+                        throw new IllegalStateException(errorMessage.toString());
                     }
                 }
-
-            } else {
-                if (rd == null) {
-                    Debug.logError("Could not get RequestDispatcher for errorPage: " + errorPage, module);
-                }
-
-                String errorMessage = "<html><body>ERROR in error page, (infinite loop or error page not found with name [" + errorPage + "]), but here is the text just in case it helps you: " + request.getAttribute("_ERROR_MESSAGE_") + "</body></html>";
-                response.getWriter().print(errorMessage);
             }
         }
 
diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
index 3243a46..864f352 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
@@ -18,6 +18,8 @@
  *******************************************************************************/
 package org.apache.ofbiz.webapp.control;
 
+import java.net.MalformedURLException;
+import org.apache.ofbiz.base.location.FlexibleLocation;
 import static org.apache.ofbiz.base.util.UtilGenerics.checkMap;
 
 import java.io.IOException;
@@ -734,14 +736,17 @@ public class RequestHandler {
 
     /** Returns the default error page for this request. */
     public String getDefaultErrorPage(HttpServletRequest request) {
-        String errorpage = null;
+        URL errorPage = null;
         try {
-            errorpage = getControllerConfig().getErrorpage();
-        } catch (WebAppConfigurationException e) {
+            String errorPageLocation = getControllerConfig().getErrorpage();
+            errorPage = FlexibleLocation.resolveLocation(errorPageLocation);
+        } catch (WebAppConfigurationException | MalformedURLException e) {
             Debug.logError(e, "Exception thrown while parsing controller.xml file: ", module);
         }
-        if (UtilValidate.isNotEmpty(errorpage)) return errorpage;
-        return "/error/error.jsp";
+        if (errorPage == null) {
+            return "/error/error.jsp";
+        }
+        return errorPage.toString();
     }
 
     /** Returns the default status-code for this request. */
diff --git a/framework/webtools/webapp/webtools/error/error.jsp b/framework/webtools/webapp/webtools/error/error.jsp
deleted file mode 100644
index 5f4de01..0000000
--- a/framework/webtools/webapp/webtools/error/error.jsp
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
---%>
-<%@ page import="org.apache.ofbiz.base.util.*" %>
-<html>
-<head>
-<title>OFBiz Message</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<% String errorMsg = (String) request.getAttribute("_ERROR_MESSAGE_"); %>
-
-<body bgcolor="#FFFFFF">
-<div align="center">
-  <br/>
-  <table width="100%" border="1" height="200">
-    <tr>
-      <td>
-        <table width="100%" border="0" height="200">
-          <tr bgcolor="#CC6666">
-            <td height="45">
-              <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FFFFFF"><b>:ERROR MESSAGE:</b></font></div>
-            </td>
-          </tr>
-          <tr>
-            <td>
-              <div align="left"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=UtilFormatOut.replaceString(errorMsg, "\n", "<br/>")%></font></div>
-            </td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-  </table>
-</div>
-<div align="center"></div>
-</body>
-</html>
diff --git a/framework/widget/dtd/widget-theme.xsd b/framework/widget/dtd/widget-theme.xsd
index 14a8c61..de4f204 100644
--- a/framework/widget/dtd/widget-theme.xsd
+++ b/framework/widget/dtd/widget-theme.xsd
@@ -157,7 +157,7 @@ under the License.
     <xs:element name="template">
         <xs:complexType>
             <xs:sequence>
-                <xs:element minOccurs="1" maxOccurs="4" ref="template-file" />
+                <xs:element minOccurs="1" maxOccurs="5" ref="template-file" />
             </xs:sequence>
             <xs:attribute type="xs:string" name="name" use="required" />
             <xs:attribute type="xs:string" name="type" use="required"/>
@@ -183,6 +183,7 @@ under the License.
                     <xs:enumeration value="form" />
                     <xs:enumeration value="tree" />
                     <xs:enumeration value="menu" />
+                    <xs:enumeration value="error" />
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java
index 0309b10..4df4836 100644
--- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java
+++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java
@@ -366,6 +366,13 @@ public class ModelTheme implements Serializable {
         }
         return null;
     }
+    public String getErrorTemplateLocation(String name) {
+        ModelTemplate modelTemplate = modelTemplateMap.get(name);
+        if (modelTemplate != null) {
+            return modelTemplate.getErrorTemplateLocation();
+        }
+        return null;
+    }
 
     public Map<String,String> getModelCommonScreens() {
         return modelCommonScreensMap;
@@ -385,6 +392,7 @@ public class ModelTheme implements Serializable {
         private final String formRendererLocation;
         private final String menuRendererLocation;
         private final String treeRendererLocation;
+        private final String errorTemplateLocation;
 
         /**
          * Constructor to initialize a ModelTemplate class from xml definition
@@ -402,6 +410,7 @@ public class ModelTheme implements Serializable {
             String formRendererLocation = null;
             String menuRendererLocation = null;
             String treeRendererLocation = null;
+            String errorTemplateLocation = null;
             for (Element templateFile : UtilXml.childElementList(template)) {
                 switch (templateFile.getAttribute("widget")) {
                     case "screen":
@@ -416,12 +425,16 @@ public class ModelTheme implements Serializable {
                     case "menu":
                         menuRendererLocation = templateFile.getAttribute("location");
                         break;
+                    case "error":
+                        errorTemplateLocation = templateFile.getAttribute("location");
+                        break;
                 }
             }
             this.screenRendererLocation = screenRendererLocation;
             this.formRendererLocation = formRendererLocation;
             this.menuRendererLocation = menuRendererLocation;
             this.treeRendererLocation = treeRendererLocation;
+            this.errorTemplateLocation = errorTemplateLocation;
         }
 
         /**
@@ -441,6 +454,7 @@ public class ModelTheme implements Serializable {
             this.formRendererLocation = exist && currentModelTemplate.formRendererLocation != null ? currentModelTemplate.formRendererLocation : originModelTemplate.formRendererLocation;
             this.treeRendererLocation = exist && currentModelTemplate.treeRendererLocation != null ? currentModelTemplate.treeRendererLocation : originModelTemplate.treeRendererLocation;
             this.menuRendererLocation = exist && currentModelTemplate.menuRendererLocation != null ? currentModelTemplate.menuRendererLocation : originModelTemplate.menuRendererLocation;
+            this.errorTemplateLocation = exist && currentModelTemplate.errorTemplateLocation != null ? currentModelTemplate.errorTemplateLocation : originModelTemplate.errorTemplateLocation;
         }
         public String getName() {
             return name;
@@ -471,5 +485,8 @@ public class ModelTheme implements Serializable {
         public String getMenuRendererLocation() {
             return menuRendererLocation;
         }
+        public String getErrorTemplateLocation() {
+            return errorTemplateLocation;
+        }
     }
 }
diff --git a/themes/common/widget/Theme.xml b/themes/common/widget/Theme.xml
index f108de1..46a5ee1 100644
--- a/themes/common/widget/Theme.xml
+++ b/themes/common/widget/Theme.xml
@@ -92,6 +92,7 @@ under the License.
             <template-file widget="form" location="component://common-theme/template/macro/HtmlFormMacroLibrary.ftl"/>
             <template-file widget="tree" location="component://common-theme/template/macro/HtmlTreeMacroLibrary.ftl"/>
             <template-file widget="menu" location="component://common-theme/template/macro/HtmlMenuMacroLibrary.ftl"/>
+            <template-file widget="error" location="component://common-theme/template/ErrorPage.ftl"/>
         </template>
         <template name="screenxml" type="xml" content-type="UTF-8" encoding="none" encoder="xml">
             <template-file widget="screen" location="component://common-theme/template/macro/XmlScreenMacroLibrary.ftl"/>