  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | - Re: How to display exception messages for fields | - Re: How to display exception messages for fields 2007-08-13 - By ellenzhao
Back "pete.muir@(protected)" wrote : Why not use hibernate validators?
1. There is less stuff to configure if I integrate the "validator" into the entity itself
2. This approach works really well with Seam when the entity travels between layers/tiers. The setter is the _only_ place where validation code is needed. In the conversation bean, I call setters of entities anyway....
3. In fact the validity of the fields belongs to business logic. The entity class is much more reusable if this business logic is contained in itself. Otherwise, the validity logic is contained in the hibernate validator, the hibernate validator dependency sneaks in....
4. The exception classes becomes a central error repository. With this approach , the view code only needs to react to POJO business exceptions....And in the message bundle, I can write localized error messages according to the type of exceptions. I prefer the concept of a business exception (which is caused by incorrect user input and recovable) to the concept of "validation exception".
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic &p=4073667#4073667
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode =reply&p=4073667 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ jboss-user mailing list jboss-user@(protected) https://lists.jboss.org/mailman/listinfo/jboss-user
|
|
 |