What Java web design structure to choose for client and server side validation?

We are currently looking for a java framework that has simplified server-side and client-side validation, Spring, Hibernate, Play is the choice of the framework we are looking for, we use annotation-based development, and this structure will also determine our choice of javascript. What is the best structure (in architecture) when checking both client-side and server-side?

+3
source share
6 answers

Client side validation (assuming "client side" means javascript) is a myth. This makes the user interface more enjoyable - no questions asked - but it cannot be called "validation" because nothing that comes from the client can be considered valid; until it is checked on the server.

Server-side validation is also not monolithic - there are at least 3 components:

  • Restrictions on data storage (for example, non-zero, maximum length, uniqueness, referential integrity, etc.) are set at the database level.
  • Validating a domain model (ensuring that your objects are valid)
  • Client input validation (user interface and, to a lesser extent, API-based validation)

# 1 # 2 - Hibernate Validatior , Hibernate JPA .

# 3. GWT, GWT VF, Jeff, , (JSR-303), Hibernate Validator. - , , XML. ExtJS.

, # 2 # 3 - , ; ..... AFAIK , 1--1 CRUD.

+4

Spring 3 ( RC2 ) , Hibernate. . Spring 3 JSR-303. , JSR-303, Hibernate Validator, . , @Valid:

@RequestMapping(value = "/appointments", method = RequestMethod.POST)
public String add(@Valid AppointmentForm form, BindingResult result) {
    ....
}

public class AppointmentForm {

    @NotNull @Future
    private Date date;
}

POST AppointmentForm; , , .

, , Javascript , Jquery Extjs .. Extjs Spring - , JQuery . Spring -js, .

+5

ChssPly76. Hibernate ( javax.validation ) , , RichFaces. beanValidator, .

RichFaces ( JSF), GWT, - , .

+2

GWT. .

+1

JSF . , , , ajax. RichFaces ( Seam), PrimeFaces IceFaces.

0

, Spring - . Spring - Hibernate.

-1

Source: https://habr.com/ru/post/1723264/


All Articles