I'm not really experienced in website and specially website security.
Before the problem, let's explain the context :
I have created a web page that is meant to be a platform with an order form X to be filled by some client A with some critical fields Y to be encrypted. Then, the web server would send a mail with X+Y to the seller B, so he can process the order.
What I did :
I created a form with Spring MVC with a controller (in Java) and an HTML view template. This tutorial helped me a bit : https://spring.io/guides/gs/handling-form-submission/. When A submits X+Y, I encrypt Y (with a symmetric TEA Encryption) in the Controller (So I guess that is obviously server-side) and then send it to the retailer by mail. Then the retailer decrypts it with the same key used for decryption.
The problem :
I would like it to be really secure so I don't want to send Y to the server and then encrypt it, I want to encrypt it on the client side and then send it to the controller.
Is Javascript client-side the only solution to do this ? I would prefer to do it in Java on the client side because what I want is that the encryption is client-side and also the source code containing the encryption algorithm hidden to anyone (which is not the case I guess in HTML and Javascript).
So, for client-side and hidden source code encryption, is it possible to do it with Spring MVC and Java, or with Javascript, or do you have any other suggestion ?