dwr3错误提示显示message详细而不是Error
如果只需要提示自定义异常,请先定义一个自定义类:
/** * @author jsczxy2 * DWR自定义异常 * */public class DwrException extends Exception {Log log = LogFactory.getLog(getClass());public DwrException(){super();}public DwrException(String message){super(message);}public DwrException(String message,Throwable cause){super(message,cause);}public DwrException(Throwable cause){super(cause);}}?
然后,在页面加入:
<script type="text/javascript">dwr.engine.setErrorHandler(function(message){alert(message);});</script>这样的话,就只有自定义异常会有message信息显示,而其他异常均提示Error.
?
全局都想提示的话,请在spring配置文件中加入 :
?
<dwr:convert type="exception" class="java.lang.Exception"><dwr:include method="message"/></dwr:convert>