⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 message.jsp

📁 订餐系统
💻 JSP
字号:
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%>
<%@page import="Dao.DBAccessException"%>
<html>
  <head>
  <script language=javascript type="text/JavaScript">
function showdetail() {
  if (exdetail.style.display == "") {
    exdetail.style.display = "none";
  } else {
    exdetail.style.display = "";
  }
}
</script>
  </head>
  <%!
      private static final char[] ERROR_CHR ={'&', '"', '\''};
      
     // 去除字符串中不能在表单中出现的字符
     //@param inStr String 要处理的字符串
      //@return String 处理后的字符串
     
    public  String toFormStr(String inStr)
    {
        String returnStr = new String(inStr != null ? inStr : "");
        for (int i = 0; i < ERROR_CHR.length; i++) {
            returnStr = returnStr.replaceAll("[" + (ERROR_CHR[i] == '\\' ? "\\\\" :
                    String.valueOf(ERROR_CHR[i])) + "]", "");
        }
        return returnStr;
    }
   %>  
  <body>
  <table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr><td colspan="5" height="5"></td></tr>
    <tr>
      <td width="39"><img src="images/title_01.gif"></td>
      <td width="150" background="images/title_02.gif" valign="baseline" class="title"><div align="center">系统提示</div></td>
      <td width="22"><img src="images/title_03.gif"></td>
      <td background="images/title_04.jpg">&nbsp;</td>
      <td width="330" background="images/title_04.jpg">
      </td>
    </tr>
    <tr><td colspan="5" height="5"></td></tr>
    <%
  
        Exception ex = (Exception)request.getAttribute("message");
        System.out.println(ex.getMessage());
        Exception oex = null;
        StackTraceElement[] ss = null;
        String msg = null;
        String omsg = null;
        String exn = null;
        if (ex != null)
         {
	          boolean showSS = true;
	          if (DBAccessException.class.isInstance(ex))
	           {
		            oex = ((DBAccessException)ex).getOldException();
		            if (oex != null)
		             {
			              ss = oex.getStackTrace();
			              omsg = oex.getMessage();
			              exn = oex.getClass().getName();
		            }
		             else 
		            {
		              showSS = false;
		            }
	          }
	          if (ss == null && showSS) 
	          {
	            ss = ex.getStackTrace();
	            exn = ex.getClass().getName();
	          }
	          msg = ex.getMessage();
          
        }
        if (msg == null || msg.equals(""))
         {
         	msg = "发生不明错误!";
         }
%>

  </table>
    <table width="75%" border=1 align="center" cellpadding="1" cellspacing="0" bordercolor="BBBBBB" bgcolor="FFFFFF">
    <tr>
      <td align="center" class="td_">
        <br><%=msg%><br><br>
      </td>
    </tr>
    <tr>
      <td height="25"><div align="center">
        <input type="button"  value="   返回   " onclick='history.back(1)'>
        <%      if (ss != null) {%>
        <input type="button" name="btndetail" class="button" value=" 详细信息 " onclick='showdetail()'>
        <%} %>
      </div></td>
    </tr>
    <tr style="display:none" id="exdetail">
      <td align="center" class="td_">
      <%      if (omsg != null) 
{%>
        <br><%=omsg%><br><br>
<%      }%>
        <textarea cols='81' rows='25' wrap='off' readonly>
        <%      if (ss != null) {
          out.print(exn+" at:\n");
          for (int i = 0; i < ss.length; i++) {
            out.print("    "+toFormStr(ss[i].toString())+"\n");
          }
        }%>
        </textarea>
      <br><br></td>
    </tr>
  </table>
  </body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -