• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

md5 jsp javascript

 
Greenhorn
Posts: 12
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 13
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic