如何从Java Servlet中获取激活链接的数据 [英] How to get data from activation link with Java Servlet

查看:104
本文介绍了如何从Java Servlet中获取激活链接的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GWT,然后用户注册,我需要向用户发送一封包含激活链接的邮件。

激活链接可能包含用户名用户和一个散列值。

使用PHP,我知道使用get方法检索这些值。



我是新的GWT Java,我希望能够获得激活链接中的值。我只是在服务器上使用Java。



我只想知道,点击激活链接后用户重定向到我的网站时需要做什么(其中包含一些数据来标识用户)。 这与GWT无关。当用户点击激活链接时,你的servlet被调用。例如,您有一个映射到 / useractivate 的servlet,并且您的URL是 http://yoursite.com/useractivate?hash=4342bc322&user = foo

然后在servlet的 doGet()方法中,您需要调用:

  String hash = request.getParameter(hash); 
String user = request.getParameter(user);
// ..句柄激活


I am using GWT and after that a user registers, I need to send the user a mail with an activation link.

The activation link might contain the username of the user and a hashed value.

With PHP, I know to retrieve these values using get method.

I am new GWT Java and I want to be able to get the values in the activation link. I am also using a Java on the server.

I just want to know, what i need to do when the user is redirected to my site after clicking on the activation link (which contains some data to identify the user).

解决方案

This has nothing to do with GWT. When the user clicks the activation link, a servlet of yours is invoked. For example, you have a servlet mapped to /useractivate, and your URL is http://yoursite.com/useractivate?hash=4342bc322&user=foo.

Then in the doGet() method of your servlet you need to call:

String hash = request.getParameter("hash");
String user = request.getParameter("user");
// .. handle activation

这篇关于如何从Java Servlet中获取激活链接的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆