<%@ taglib uri="http://xmlns.oracle.com/bibeans/jsp"  prefix="orabi" %>
<%@ page contentType="text/html;charset=WINDOWS-1252"%>
<%@page import="oracle.dss.thin.beans.util.ErrorDialogBean" %>
<%@page import="oracle.cabo.ui.ServletRenderingContext" %>
<%@page import="oracle.dss.addins.jspTags.ThinPageSession" %>
<%@page import="oracle.cabo.ui.data.provider.TableDataProvider" %>
<%@page import="oracle.cabo.ui.data.servlet.HttpSessionDataObject" %>
<%@page import="oracle.cabo.ui.data.servlet.PageContextDataObject" %>
<%@page import="oracle.cabo.ui.data.servlet.ServletContextDataObject" %>
<%@page import="oracle.cabo.ui.data.servlet.ServletRequestDataObject" %>
<%@page import="oracle.cabo.ui.partial.PartialPageUtils" %>
<%@page import="oracle.dss.thin.beans.CaboUtils" %>
<%@page import="oracle.cabo.ui.UIConstants" %>

<%@page isErrorPage="true" %>
<% synchronized(session){ %>
<%

   //create the Error dialog here
   ErrorDialogBean errorDialogBean = new ErrorDialogBean();
   
   pageContext.setAttribute("errorDialog", errorDialogBean);
   
   ServletRenderingContext renderingContext = (ServletRenderingContext) 
                                              pageContext.findAttribute ( 
                                              ThinPageSession.SERVLET_RENDERING_CONTEXT_KEY );
     
    if(!(renderingContext != null && renderingContext.getJspPageContext() == pageContext)) {
    
      ServletRenderingContext newContext = new ServletRenderingContext ( pageContext );      
      TableDataProvider tdp = new TableDataProvider();    
      tdp.put("", "servletRequest", new ServletRequestDataObject(pageContext.getRequest()));
      tdp.put("", "httpSession", new HttpSessionDataObject(session));
      tdp.put("", "servletContext", new ServletContextDataObject(pageContext.getServletContext()));
      tdp.put("", "pageContext", new PageContextDataObject(pageContext));
      newContext.addDataProvider(tdp);
      if (renderingContext != null)
        newContext.setConfiguration(renderingContext.getConfiguration());
      pageContext.setAttribute ( ThinPageSession.SERVLET_RENDERING_CONTEXT_KEY, 
                                 newContext, 
                                 PageContext.REQUEST_SCOPE );      

      if( "true".equals(request.getParameter(UIConstants.PARTIAL_PARAM))) {

        session.setAttribute("curBIExp",exception);   
        exception = null;
        String errorpageURI = request.getContextPath() + "/"+ "cabo/bi/jsp/error.jsp";  
        PartialPageUtils.forceRedirectURL(newContext, errorpageURI);
      }
      else {
                  
        if( exception == null)
          errorDialogBean.setException((Exception) session.getAttribute("curBIExp"));
        else {
          errorDialogBean.setException(exception);
          exception = null;
        }
          
        session.removeAttribute("curBIExp");
        
      }
      
      
                                 
    }
%>
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=WINDOWS-1252">
</head>
<orabi:BIBody>
  <form name="form1" method="POST" action="cabo\bi\jsp\error.jsp">
    <orabi:InitBITags parentForm="form1" />
    <orabi:Render targetId="errorDialog" />
    
    
  </form>
</orabi:BIBody>
</html>
<% } %>
