• Post Reply Bookmark Topic Watch Topic
  • New Topic

Activating account via java mail

 
janice ang
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm having some trouble trying to send an activation link using java mail in order for newly registered users to activate their account by clicking on the link in the email. How am I suppose to go about that? My concept is:
to generate a random id and this id is to be inserted into the db together with the information that a user entered in the registration form. then a comparison will be carry out to determine the right random_id and the id will be attached to the link. am i on the right track? by the way, when i include the random function (see below) my result for my random id is "java.util.Random@12r433" why will the java.util.Random@ appear?

my code for random function is:
Random rdn = new Random();
rdn.nextInt();

pls help. thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You're probably doing something like rdn.toString(), but that returns a reference to the memory location where the object is stored - it has nothing to do with any random value. If you look at the javadocs for the RAndom class you'll see that a pseudorandom int (or long) can be gotten from the nextInt (or nextLong) method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!