the jsp is executed on the server while the js code is executed by the browser on the client, so you can't store it.
You can always run a method on the server:
Now when you will click the second link you will modify the first one (it contains a parameter named "md5" with the desired value).
Anyone can see your js function code, so be careful.
I don't know what you really want but i hope this example will help you.