在form 中的Validate()方法中return了ActionErrors,如何在jsp页面中获取这个异常,不使用<html:errors>等标签,就用代码获取错误信息。希大虾们赐教。
解决方案 »
- 高分求教,ssh annotation 在DAO如何注入sessionFactory
- 将一段Java代码转换为C#···求高人指点··
- 关于checkbox和JSP显示日历
- 外包一个页面,顺便推荐这个网络收藏夹--偶得
- java读取数据库数据的问题
- 求助:有关EJB的问题?(急)
- 应该采用什么方法将项目组成员所写的代码合起来?怎样合? (后台是用jb写的ejb,容器weblogic,前台是用jb写的struts)
- 加入ejb-link后出错!!!怎么办!!???
- 请教jdbc与oracle817的连接问题谢谢!!!!!!!
- 一个方法执行效率问题
- 如何在[color=#FF0000]当前页[/color]得到表单中的值(不用javascript)?
- ibatis 关于<iterate>嵌套使用的问题
<!--exception-type设定处理那种异常或子类,location设定捕获到该异常后转向去哪里-->
<error-page>
<exception-type>org.xiaohanne.simplemvc.exception.ErrorPageException</exception-type>
<location>/error/error.jsp</location>
</error-page> <!--exception-type设定处理那种异常或子类,location设定捕获到该异常后转向去哪里-->
<error-page>
<exception-type>org.xiaohanne.simplemvc.exception.ErrorPageException</exception-type>
<location>/error/error.jsp</location>
</error-page>error.jsp 这个页面因为isErrorPage="true"所以能取默认的exception
Java代码
<%@page contentType = "text/html;charset=gb2312" %>
<%@page isErrorPage="true"%>
<html>
<head>
<title>错误处理</title>
<meta http-equiv="Expires" content="">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css">
<body color=#FF0000>
<br><br><br>
<table width="400" bgcolor=#EEEEFF align=center border="0" cellspacing="0" cellpadding="0">
<tr class=th height=22><td colspan=10>&错误提示</td></tr>
<tr bgcolor=#CCCCEE height=1><td colspan=10></td></tr>
<tr>
<td width=30 rowspan="4">&</td>
<td>
<font color=#0000FF><font color="#0000FF">错误信息为:<%=exception.getMessage();%>
<%--根据配置文件或url参数决定是否显示--%>
<%String sIsDebug=request.getParameter("debug");;
if(sIsDebug==null||sIsDebug.equals("");); sIsDebug="false";
if(org.xiaohanne.simplemvc.config.Configurator.isDebug();||sIsDebug.equals("true"););{%>
<hr>
错误详细信息(供管理人员调试);:<%=exception.toString();%>
<hr>
错误堆栈(供管理人员调试);:<br><%=((org.xiaohanne.simplemvc.exception.ErrorPageException);exception);.toTrace();%>
<%}%>
</font></font>
</td>
<td height="69">&</td>
</tr>
<tr height=30 valign=center>
<td valign="top" align="right"><a href='javascript:history.go(-1);;'>返回上页</a></td>
</tr>
<tr bgcolor=#CCCCEE height=1><td colspan=10></td></tr>
</table>
</body>
</html>
HttpServletRequest request) {
// TODO Auto-generated method stub
String accountNumber=getAccountNumber();
String password=getPassword();
ActionErrors errors=new ActionErrors();
if(accountNumber.equals("")){
errors.add("ActionErrors.GLOBAL_MESSAGE",new ActionMessage("accountNumber.none"));
return errors;
}
if(password.equals("")){
errors.add("ActionErrors.GLOBAL_MESSAGE",new ActionMessage("password.none"));
return errors;
}
return null;
}
请问怎么从ActionErrors把错误信息取出来?