OpenWGA 7.5 - OpenWGA Concepts and Features

Administration » Features

Custom error page

In certain situations OpenWGA cannot serve any content and needs to express this in some kind of HTTP error. Among the causes for this may be invalid URL paths that are called but also a misconfigured web apps.

For these situations OpenWGA has a standard error page which is shown and displays some information about the cause of the error. However this error page is specific to OpenWGA as a content management product. Many websites will want to issue an error page that is specific to this site instead.

To accomplish this OpenWGA can be given information about a custom error page. It can be configured in OpenWGA admin client under menu "Configuration > Custom Error Page":


Here the code of a custom error page can be specified. Here raw Java Server Pages code is expected, unlike in WebTML modules. The reason for this is that the error page should still be able to work when the WebTML runtime itself has problems, so plain JSP code is the most likely to work in any situation.

Here is some template code that can be used to build a custom error page:

<%@page isErrorPage="true" autoFlush="true" contentType="text/html; charset=ISO-8859-1" isThreadSafe="true" %>

<jsp:useBean class="de.innovationgate.wgpublisher.WGAError" id="WGAError" scope="request"/>


<head> <title>Error!</title> </head>


<!-- The main error message that normally is displayed first on the default error page (String) -->

Error: <jsp:getProperty name="WGAError" property="mainMessage"/><br/>

<!-- Specifical error information normally shown as second row on the default error page (String) -->

Sub message: <jsp:getProperty name="WGAError" property="subMessage"/><br/>

<!-- Some more technical detail message, available when an internal server error occurs (String) -->

Detail: <jsp:getProperty name="WGAError" property="detailMessage"/><br/>

<!-- The HTTP error code, if the encountered error is a HTTP error (Integer) -->

Error Code: <jsp:getProperty name="WGAError" property="errorCode"/><br/>

<!-- boolean variable, showing if the current error is a HTTP error or not (Boolean) -->

Is Http Error: <jsp:getProperty name="WGAError" property="httpError"/><br/>

<!-- A java stack trace if the encountered error is a internal server error. (String) -->

Stack trace: <jsp:getProperty name="WGAError" property="stackTrace"/><br/>

<!-- Name of a WebTML module where the error occured, null if the error didn't occur in WebTML (String) -->

Eventually responsible design: <jsp:getProperty name="WGAError" property="maybeResponsibleDesign"/><br/>



The code written in bold consists of JSP tags which are used to provide information about the error that occured to the page. The tag <jsp:useBean> loads a bean object "WGAError" into the page whose properties then can be read using tag <jsp:getProperty>.

The following table lists the available properties on the WGAError object:

Property Contents Example content
detailMessage A technical detail error message, available for internal server errors only NullpointerException: null
errorCode The HTTP error code of the occurred error 404
mainMessage The main error message, normally displayed first on the default error page An error occured while processing your request
maybeResponsibleDesign Name of a WebTML module where the error occurred. May be null when the error occurred outside of any module  
stackTrace A technical detail error information, showing the exact location where the error occurred in the server code, often helpful to track down the reason of an error  
subMessage Specific information about the error, displayed on the default error page in the second row Http Error 404 - Content of name/id 'home' does not exist or is not visible for user 'anonymous'
Besides the WGAError object a custom error page also has access to the usual resouces that a JSP page is able to use, for example using the "request" and "response" objects in JSP java scriptlets. For a detail overview of JSP capabilities see the chapter about Java Server Pages in the Java EE Tutorial.