• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

md5 jsp javascript

 
ankur mawandia
Greenhorn
Posts: 12
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to use a javascript to md5 a given string in my jsp page
how can i include the javascript and call the function in the javascript to manipulate the variables
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64618
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to find an MD5 implementation in JavaScript and use it according to its directions.

Are you sure this is something you want to do on the client? This is something usually done on the server.
 
Blaidd Gwael
Greenhorn
Posts: 13
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See MD5 function

You create a md5.js file that contains that code.
Include the md5.js file in your jsp:



do something like:

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And then I do a view source and I can see exactly what is getting hashed and how. Not only that, but MD5 isn't really a trusted hash anymore these days.
 
ankur mawandia
Greenhorn
Posts: 12
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your reply
how can i store this javascript variable value in a another jsp variable for posting in the database


thanks again
 
Blaidd Gwael
Greenhorn
Posts: 13
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:



For javascript you'll have to modify the link that goes on the server. If you have



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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic