简体   繁体   中英

How to dynamically generate Validations for the Front end depending upon the Logic

Consider the page below. As in the image I have attached. 在此处输入图片说明

Now my problem is that I have multiple clients accessing the same page as given below. Now consider that each client has their own requirement such as:-

  1. Name is mandatory for some clients not for others.
  2. Age is mandatory for some clients but not for others along with some specific validations like age<20 or age>30 etc.
  3. Search is also optional depending upon the clients.

Now I am searching for any such tools or technologies or methods that could help me to sort out the issue of dynamically validating the fields as well as hiding and showing the fields depending upon my clients. Please let me know any tools or technologies that can help in order to solve the above problem. I also heard about rule engine and templating .... Is it possible to work together with it to achieve the same. Please suggest.

I have no idea why hibernate-validator would not work here. You implement the validation as you want, by implementing an interface and creating your own validation annotations if needed. This is a server-side validation btw.

Showing or not some content in case of JSP is done with conditional :

c:when/c:choose 

for example, assuming it's JSP you are using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM