-1

I need to encrypt a value contained in an html div when a user clicks on a button.

In order to do this, I'm calling my custom encryption function from a java plugin inside the javascript onClick() code. The java plugin is a server-side package containing classes of functions that can be called inside the client-side code.

The problem is than my custom function can only take a hardcoded string as parameter :

  • ${fn:myCustomFunc("myString")} encrypts the string myString
  • ${fn:myCustomFunc(myStringVariable)} doesn't encrypt the string contained inside myStringVariable.

Is there a way, inside my java function, to scan the current page to get the inner html of the element I need ?

daniel.rna
  • 73
  • 1
  • 11
  • java or Javascript..? – Satej S Feb 23 '16 at 11:48
  • @SatejS my encryption function is java. the script in wich I call this function is javascript. – daniel.rna Feb 23 '16 at 12:59
  • What is your understanding of a *"java plugin"*? Are you talking about a Java applet or about server-side code? If it's the latter, there are obviously requests going over the wire (see: [What is the difference between client-side and server-side programming?](http://stackoverflow.com/q/13840429/1816580)). Since you haven't shared what the *"java plugin"* is doing, this question is impossible to answer. – Artjom B. Feb 23 '16 at 13:36

1 Answers1

1

On button click, you can send your string variable to a java class from HTML page and in that java class you can perform encryption.

Deepanshu
  • 142
  • 1
  • 12
  • The only way I know to do so is to use jsp, and unfortunately I can't in my actual context. I can only use javascript, html, and java. The java functions are contained in a plugin deployed on the server, and can be called in the html or javascript. – daniel.rna Feb 23 '16 at 13:07
  • You can invoke java methods on jsp page as well. – Deepanshu Feb 24 '16 at 03:43