This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.



Sep 2, 2011, 12:18 AM
21 Posts

Where is the default server error page stored?

  • Category: Other
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: ErrorPage
  • Replies: 3
Hi there!
 
Where is the default Server Error Page stored?
Alertnatively,  where do i get the information about "Error Source" (Pagename, ControlId, Property), line, col and script code, displayed in the default server error page?
 
I would like to create my own Error Page and therefore i would like to look at the source code of the default error page.
 
Thanks Mario!
Sep 2, 2011, 1:53 PM
66 Posts
Re: Where is the default server error page stored?
 Hi Mario, I'm not sure where the default error page is stored, but I've made a custom error page that will give you a starting point at least. Just copy the code into the source of an XPage and set the Error page in the Application Properties to that page.
 
 <?xml version="1.0" encoding="UTF-8"?>
<xp:view
xmlns:xp="http://www.ibm.com/xsp/core"
>
<xp:div>
<xp:table>
<xp:tr>
<xp:td>
<xp:label
id="label1"
value="We're sorry, there has been an error..."
style="font-size:12pt;font-weight:bold" />
</xp:td>
</xp:tr>
</xp:table>
<xp:br />
<xp:section
id="section2"
header="Error Details"
type="box"
>
<xp:br />
<xp:table>
<xp:tr>
<xp:td>
<xp:label
id="label9"
style="font-weight:bold;text-decoration:underline"
value="Error source" />
</xp:td>
</xp:tr>
</xp:table>
<xp:table>
<xp:tr>
<xp:td>
<xp:label
value="Browser Version:"
id="label2"
style="font-weight:bold" />
</xp:td>
<xp:td>
<xp:label
id="BrowserVersion"
>
<xp:this.value><![CDATA[#{javascript:var br = context.getUserAgent().getBrowser();
var bv = context.getUserAgent().getBrowserVersion();
@UpperCase(br)+" "+bv}]]></xp:this.value>
</xp:label></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Control Id:"
id="label3"
style="font-weight:bold" />
</xp:td>
<xp:td>
<xp:text
escape="false"
id="ControlError"
>
<xp:this.value><![CDATA[#{javascript:/*/code for control (button click etc.)
if(error instanceof com.ibm.xsp.exception.XSPExceptionInfo === false) {
var msg = requestScope.error.getCause();
return msg.getErrorComponentId();
}
//code for event (onClientLoad etc.)
else if (error instanceof com.ibm.xsp.exception.XSPExceptionInfo === true) {
return error.getErrorComponentId();
else {
""
}
*/

error instanceof com.ibm.xsp.exception.XSPExceptionInfo === true ? error.getErrorComponentId() : requestScope.error.getCause().getErrorComponentId();}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Property:"
id="label4"
style="font-weight:bold" />
</xp:td>
<xp:td>
<xp:text
escape="false"
id="PropertyError"
>
<xp:this.value><![CDATA[#{javascript://code for control (button click etc.)
if(error instanceof com.ibm.xsp.exception.XSPExceptionInfo === false) {
var msg = requestScope.error.getCause();
return msg.getErrorPropertyId();
}
//code for event (onClientLoad etc.)
else if (error instanceof com.ibm.xsp.exception.XSPExceptionInfo === true) {
return error.getErrorPropertyId();
else {
""
}}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label
value="Cause:"
id="label21"
style="font-weight:bold" />
</xp:td>
<xp:td>
<xp:text
escape="false"
id="Cause"
>
<xp:this.value><![CDATA[#{javascript://code for control (button click etc.)
if(error instanceof com.ibm.xsp.exception.XSPExceptionInfo === false) {
var myerror:com.ibm.xsp.exception.EvaluationExceptionEx = requestScope.error;
return myerror.getCause().getMessage();
}
//code for event (onClientLoad etc.)
else if (error instanceof com.ibm.xsp.exception.XSPExceptionInfo === true) {
var myerror:com.ibm.xsp.exception.EvaluationExceptionEx = requestScope.error;
return myerror.getCause().getMessage();
else {
""
}}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
</xp:table>
<xp:br />
<xp:table>
<xp:tr>
<xp:td>
<xp:label
id="label8"
style="font-weight:bold;text-decoration:underline"
value="Exception" />
</xp:td>
</xp:tr>
</xp:table>
<xp:table>
<xp:tr>
<xp:td>
<xp:text
escape="false"
id="ErrorMessage"
>
<xp:this.value><![CDATA[#{javascript://code for control (button click etc.)
if(error instanceof com.ibm.xsp.exception.XSPExceptionInfo === false) {
//var msg = requestScope.error.getCause();
return requestScope.error.getMessage();
}
//code for event (onClientLoad etc.)
else if (error instanceof com.ibm.xsp.exception.XSPExceptionInfo === true) {
return error.getMessage();
else {
""
}}]]></xp:this.value>
</xp:text>
</xp:td>
<xp:td />
</xp:tr>
<xp:tr>
<xp:td>
<xp:text
escape="false"
id="ErrorText"
>
<xp:this.value><![CDATA[#{javascript://code for control (button click etc.)
if(error instanceof com.ibm.xsp.exception.XSPExceptionInfo === false) {
//var msg = requestScope.error.getCause();
//return msg.error.getErrorText();
return "unknown..."
}
//code for event (onClientLoad etc.)
else if (error instanceof com.ibm.xsp.exception.XSPExceptionInfo === true) {
return error.getErrorText();
else {
""
}}]]></xp:this.value>
</xp:text>
</xp:td>
<xp:td />
</xp:tr>
</xp:table>
<xp:br />
<xp:br />
<xp:table>
<xp:tr>
<xp:td>
<xp:label
id="label7"
style="font-weight:bold"
value="Stack Trace:" />
</xp:td>
<xp:td />
</xp:tr>
<xp:tr>
<xp:td colspan="2">
<xp:text
escape="false"
id="computedField2">
<xp:this.value><![CDATA[#{javascript:if (requestScope.error !== null) {
var stackTrace = "";
var trace = requestScope.error.getStackTrace();
for(var i = 0; i < trace.length; i++){
stackTrace += trace[i]+ "<br />";
}
return stackTrace;
}}]]></xp:this.value>
</xp:text>
</xp:td>
</xp:tr>
</xp:table>
</xp:section>
</xp:div>
</xp:view>
Sep 3, 2011, 2:46 AM
21 Posts
Re: Where is the default server error page stored?
Thanks Ryan for this very helpful tips!!!

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.