Example usage for javax.servlet.jsp JspException getLocalizedMessage

List of usage examples for javax.servlet.jsp JspException getLocalizedMessage

Introduction

In this page you can find the example usage for javax.servlet.jsp JspException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.opencms.jsp.CmsJspTagDisplay.java

/**
 * Includes the formatter rendering the given element.<p>
 *
 * @param element the element// w w w. j a va 2  s  . co m
 * @param formatter the formatter configuration bean
 * @param editable if editable
 * @param canCreate if new resources may be created
 * @param canDelete if the resource may be deleted
 * @param creationSiteMap the create location sub site
 * @param postCreateHandler the post create handler
 * @param context the page context
 * @param request the request
 * @param response the response
 */
public static void displayAction(CmsContainerElementBean element, I_CmsFormatterBean formatter,
        boolean editable, boolean canCreate, boolean canDelete, String creationSiteMap,
        String postCreateHandler, PageContext context, ServletRequest request, ServletResponse response) {

    if (CmsFlexController.isCmsRequest(request)) {
        // this will always be true if the page is called through OpenCms
        CmsObject cms = CmsFlexController.getCmsObject(request);
        Locale locale = cms.getRequestContext().getLocale();
        boolean isOnline = cms.getRequestContext().getCurrentProject().isOnlineProject();
        CmsJspStandardContextBean contextBean = CmsJspStandardContextBean.getInstance(request);
        CmsContainerElementBean parentElement = contextBean.getElement();

        try {
            if (formatter != null) {
                element.initResource(cms);
                element.initSettings(cms, formatter);
                boolean openedEditable = false;
                if (editable && contextBean.getIsEditMode()) {
                    if (CmsJspTagEditable.getDirectEditProvider(context) == null) {
                        I_CmsDirectEditProvider eb = new CmsAdvancedDirectEditProvider();
                        eb.init(cms, CmsDirectEditMode.TRUE, element.getSitePath());
                        request.setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER, eb);
                    }
                    openedEditable = CmsJspTagEdit.insertDirectEditStart(cms, context, element.getResource(),
                            canCreate, canDelete, null, creationSiteMap, postCreateHandler);
                }
                contextBean.setElement(element);
                try {
                    CmsJspTagInclude.includeTagAction(context,
                            cms.getRequestContext().removeSiteRoot(formatter.getJspRootPath()), null, locale,
                            false, isOnline, null, CmsRequestUtil.getAtrributeMap(request), request, response);
                } catch (JspException e) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
                if (openedEditable) {
                    CmsJspTagEdit.insertDirectEditEnd(context);
                }
            }
        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
        contextBean.setElement(parentElement);
    }

}