【相关文章:ASP.NET配置】
error categorization 【扩展阅读:关注Solaris 10的10大新变化】
【扩展信息:用JDOM实现数据库到XML的转换】problem error handling becomes complex for an n-tiered application. in a browser-based application, the errors can be handled in the client layer using javascript and in the web tier or ejb (enterprise javabeans) tier using custom java methods. building an infrastructure for consistent error reporting proves more difficult than error handling. struts provides the actionmessages/actionerrorsclasses for maintaining a stack of error messages to be reported, which can be used with jsp tags like <html: error> to display these error messages to the user. the problem is reporting a different category/severity of the message in a different manner (like error, warning, or information). to do that, the following tasks are required:register the errors under the appropriate category identify these messages and show them consistently
struts best practice
struts´ actionerrors class comes in handy in resolving the first issue of stacking messages of different categories. to display the error messages of different categories, define these categories such as fatal, error, warning, or info, in an interface. then, in the action or form-bean class, you can use:
errors.add("fatal", new actionerror("....")); or
... 下一页