File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Activate Account by clicking url in email Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Activate Account by clicking url in email" Watch "Activate Account by clicking url in email" New topic

Activate Account by clicking url in email

pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

i have one registration page.In the button click event(submit) when user click on submit button a confirmation mail should be sent to the User. User should confirm mailid by clicking on link sent in mail. .
On click of link in email or on copy/paste activate account ( Redirect to activation page)
This link shall expire after clicking once. please suggest me .

I have send the mail. its work fine. but can some one suggest method to activate Account by clicking the link. I am using spring,jsf, jpa,jboss.

Thanks in advance...

Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 430

During the registration you create a random activation key that you save somewhere (e.g. database). Your activation controller (the one that is called when the user clicks the link) search in the database for this activation key and if it's found mark the user with a flag as 'activated'. If it's not found (or the activation-flag is already set), show an error message.
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

Thanks Joachim Rohde,

when the user register with my application I am storing 0 as activation code in database and same time sending mail to that user.

what i have to know is that,

how to change that activation code 0 to 1 by clicking url in email.

Thanks in advace...
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
You include the activation key (which needs to be unique as well as random) as a parameter in the URL in your mail.

pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

yes.. In email , i am sending this link "http://localhost:8080/prototype5JTA/faces/activate.jsp?activate=1&acid=70" . so when user click this link in email. i want get that activate id and cid. if i can get those in to jsf manage bean i can update database. any suggestions ?

Thanks in Advance
Rob Spoor

Joined: Oct 27, 2005
Posts: 20275

request.getParameter("activate") and request.getParameter("acid") in your JSP file?

How To Ask Questions How To Answer Questions
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

Thanks.. But when user click email link in email from server side i have to update database. so for that i have to get parameter to java class or implement method when user click url in mail.
? so I don't want get url parameters in jsp page. i want get update database when user click url in email. any suggestion

Thanks in Advance
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
There's no way to connect to a DB from a link embedded in an email; it will have to go through server processing of some kind via HTTP. If you don't want JSP, fine - use a servlet (better anyway), or PHP, or ASP.Net, or whatever other server-side technology you prefer.
I agree. Here's the link:
subject: Activate Account by clicking url in email
jQuery in Action, 3rd edition