I am giving a link to user to activate his account. Link is http://xyz.in/JSF_WEB_WFE/faces/index.jsp?confirmuser=jona&emailid=valid. I read the parameters in a Beans constructor and then making some decision like, activated / already activated. It works fine in local but while we deploy in web some times it works fine and some time not. what may be the problem. What can we do for better solution?
public AuthendicationBean() {
try {
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
if (request.getParameter("confirmuser") != null && request.getParameter("emailid") != null) {
int i = AccountManager.activationUser(request.getParameter("confirmuser"), request.getParameter("emailid"));
if (i == 1) {
activationmessage = "<b>" + request.getParameter("confirmuser") + " is Activated</b>";
activerender = true;
FacesContext.getCurrentInstance().addMessage("userForm", new FacesMessage(request.getParameter("confirmuser") + "\t is Activated" + i));
} else if (i == 2) {
activationmessage = "<b>" + request.getParameter("confirmuser") + " is Deactivated</b>";
activerender = true;
FacesContext.getCurrentInstance().addMessage("userForm", new FacesMessage(request.getParameter("confirmuser") + "\t is Deactivated"));
} else {
activationmessage = "<b>" + request.getParameter("confirmuser") + "  is activated</b>";
activerender = true;
FacesContext.getCurrentInstance().addMessage("userForm", new FacesMessage(request.getParameter("confirmuser") + "\t is already Deactivated"));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return "";
}