你用 exception.getMessage()
获得错误类型以后     
自己添加switch语句 
对于不同的错误类型,显示不同的页面表达就可以了 可以说网络出错 或者 数据库出错 
很简单

解决方案 »

  1.   

    <%@ page contentType="text/html;charset=gb2312" isErrorPage="true"%>  
    <HTML>
    <HEAD>
    <link rel="stylesheet" type="text/css" href="/style/sound.css">
    </HEAD>
    <body bgcolor=gray topmargin="10" leftmargin="0" id="TheBody">
    <table border="0" bgcolor=#e0e0e0 align="center" cellspacing="0" style="BORDER-RIGHT:gray 2px solid; BORDER-TOP:white 2px solid; BORDER-LEFT:white 2px solid; BORDER-BOTTOM:gray 2px solid" width="407">
      <tr>
        <td width=10px></td>
    <td><%=exception.getMessage()%></td>
      </tr>
    </table>
    </body>
    </HTML>
      

  2.   

    1)在将中文数据插入到数据库中之前,将原先unicode编码的string类型数据转化为
    “ISO8859-1”编码,具体操作如下:
    //srcstring为源字符串,deststring为转换后的字符串。
    byte[] temp=srcstring.getBytes("iso-8859-1");
    String deststring=new String(temp);
    2)在将中文数据插入到数据库中之前,先得到byte[]类型的数据,然后利用这些数据
    建立一个GB2312编码的字符串,具体操作如下:
    //srcstring为源字符串,deststring为转换后的字符串
    char[] temp=srcstring.getChars();
    byte[] b=new byte[temp.length];
    for(int i=0;i<temp.length;i++)
    {
    b[i]=(byte)temp[i];
    }
    deststring=new String(b,"GB2312");
      

  3.   

    应该在之前定义自己的错误类型,并跑出的错误转换为自己定义的类型,
    然后再error.jsp中使用
    if(e instnaceof MyDBException )
    ...
    else if ...
    ..
      

  4.   

    将其他页面全部做异常处理,然后将抛出的异常截获后转发给error.jsp页面,然后显示。
      

  5.   

    String errMsg = "……";
    error.jsp?errMsg=<%=errMsg%>