Reputation: 135
I am doing encryption and decryption of message at javascript and want to send result message to the spring controller mvc.
@RequestMapping(value = "/token")
public @ResponseBody String getAllBooks(@RequestParam boolean isAuth, @ModelAttribute("somedata") Token data) {
ModelAndView mav = new ModelAndView();
mav.addObject("encryptedToken", data.getValue()); return token;}
Hence the token should hold the value from javascript. I am not using jquery. How to get that value from javascript to Spring mvc controller.
<script>
function Encrypt(msg) {
...................
...................
return encryptedFinally;}
</script>
I want to use this variable (i.e. encryptedFinally) in java controller class.
Upvotes: 2
Views: 3239
Reputation: 2535
I think that you have a number of choices:
At first glance, for your problem I'd choose option number one.
Upvotes: 1
Reputation: 7383
Add a hidden input into your form and set the value of this input to the result of the encryption from your javascript code.
Upvotes: 0