[opencms-dev] How do you customize error page

Tim Van Der Hulst Tim.VanDerHulst at waidc.govt.nz
Tue Feb 15 05:03:01 CET 2005


Hi Alex,

Thanks for your suggestion re: 500 error handler.

I'm using tomcat 4.1 and nothing is working..
Perhaps I have understood incorrectly?

I've tried this..

<error-page>
        <error-code>500</error-code>
        <location>/opencms/error.html</location>
    </error-page>

and this (including several types of exceptions)

<error-page>
  	<exception-type>java.lang.Exception</exception-type> 
        <location>/opencms/error.html</location>
    </error-page>

and nothing works :(

Tomcat loads up without errors (and works fine for 404 errors, etc) but I still get the opencms error page on exceptions :(

I could just double check I have try/catch's around every piece of java code i've written but I really want to customize this as a last resort.

Anyone else figured this out??

Thanks

TiM
 



-----Original Message-----
From: Alexander Kandzior [mailto:alex at opencms.org]
Sent: Friday, 11 February 2005 11:16 p.m.
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] How do you customize error page


Forgive me if I am stating the obvious, but on you your JSP you need to
write some code like this:

CmsJspAction Element cmsJsp; // need to be initialzed
CmsObejct cms = cmsJsp.getCmsObject();

boolean success;
try {
cms.addWebuser(...);
success = true;
} catch (Excaption e) {
success = false;
}

if (success) {
// display some success message
} else {
// display some failure message
}


To customize the OpenCms core error pages themself is IIRC not possible in
OpenCms 5 without hacking the core. What you can do is add a 500 (internal
server error) handler using standard Java Webapp means, which should then be
invoked in case of any error in OpenCms.

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com

 

> -----Original Message-----
> From: opencms-dev-bounces at opencms.org 
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of James
> Sent: Friday, February 11, 2005 11:04 AM
> To: 'The OpenCms mailing list'
> Subject: RE: [opencms-dev] How do you customize error page
> 
> This is exactly what I want to know.
> 
> How do you customize the cmsExceptions that are thrown?
> 
> Say when you try to addWebUser and the user already exists, 
> how do I customize the error message that is thrown or 
> capture the error and send back a certain value to the JSP 
> page that has caused it????? 
> 
> Please.... .... somebody... .... anybody........
> 
> 
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Tim Van 
> Der Hulst
> Sent: 10 February 2005 23:06
> To: The OpenCms mailing list
> Subject: RE: [opencms-dev] How do you customize error page
> 
> This covers the webserver errors (eg 404,500,etc). Not 
> opencms errors...
> 
> -----Original Message-----
> From: Daniel Rhoden [mailto:drhoden at iiwinc.com]
> Sent: Friday, 11 February 2005 11:58 a.m.
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] How do you customize error page
> 
> 
> The web.xml file has an entry for the 404 error mapping.  I 
> do not know for sure, but I suspect that you would enter the 
> location of the page
> (VFS) hosted by openCMS.
> 
> --Daniel
> 
> Tim Van Der Hulst wrote:
> 
> >Forgive my noobness but please can someone help me out here!!!
> >
> >HOW DO YOU CUSTOMIZE THE OPENCMS ERROR PAGE?
> >
> >I've looked around where I thought it might live, (eg
> /system/workplace/templates/, etc) but I can't find it. Am I 
> stupid? or what??
> >
> >Thankyou,
> >
> >TiM
> >
> >
> >-----Original Message-----
> >From: Tim Van Der Hulst
> >Sent: Friday, 4 February 2005 3:37 p.m.
> >To: The OpenCms mailing list
> >Subject: [opencms-dev] How do you customize error page
> >
> >
> >Can someone enlighten me.
> >I have not seen answer to this question.
> >I'm using version 5
> >
> >Thankyou,
> >
> >TiM
> >
> >##
> >##
> >
> >
> >_______________________________________________
> >This mail is send to you from the opencms-dev mailing list To change 
> >your list options, or to unsubscribe from the list, please visit 
> >http://mail.opencms.org/mailman/listinfo/opencms-dev
> >##
> >##
> >
> >
> >_______________________________________________
> >This mail is send to you from the opencms-dev mailing list To change 
> >your list options, or to unsubscribe from the list, please visit 
> >http://mail.opencms.org/mailman/listinfo/opencms-dev
> >
> >  
> >
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list To 
> change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> ##
> ##
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list To 
> change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list To 
> change your list options, or to unsubscribe from the list, 
> please visit http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
> 



_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev
##
##



More information about the opencms-dev mailing list