Search code examples
javaarchitecturejakarta-eeejbbusiness-logic

Business Logics on the client side


Why do people say that business logics should be implemented on the server side code (e.g. EJB) and not on the client application code?

The example that I have in mind is a business object validation on a EJB based architecture. Does it really have to be delegated to the EJB or is it ok to run it on the client before the object is sent to the server to be saved?


Solution

  • Validation can be done client-side in order to save the round-trip to the server. But the server should also perform the same validation. Ideally, you can reuse the same classes on both client and server-side.