The question is in this context:
- Consider a web application having a form that users fill up.
The same business logic is also applied at the server side after the form gets submitted, albeit, in Java to guard against any mishaps/manipulations at the browser side.
JSR-94 is a Java specification, so I don’t see what it has to do with the browser.
There’s Google JSON rules:
You said you tried the AJAX route. Does that mean a rules engine running on the server and an asynch call to access it?
This is a valid question. From this article, JSR 94
does not standardize the following:
The rule engine itself
The execution flow for rules
The language used to describe the rules
The deployment mechanism for Java EE technology
Thus, it may be possible to use a DSL that could be executed on the client and server, and this could be developed, executed, and managed as per the JSR 94 architecture. Or not.
Another article Creating a simple rules engine using the Java scripting API employs JSR-233 plus other stuff to create a rule engine system. This however predates the JSR 94.
I got to this stackoverflow page since I too was looking for a solution. Currently, I have a page to validate on client side where groups of fields can trigger different validation rules, and requirements are changing. To write this in imperative code just creates a mess with high cyclomatic complexity.
To answer your question, to my knowledge there’s no common library that can be used both on the client side and the server side.