In my project, I need to ensure that the username entered by a user is unique and does not match any other usernames already registered. This validation process occurs in newuser.jsp, where a function called searchForUsername in SemanticSearch.java is executed. Additionally, when a new user registers, their email address must also be validated before checking the uniqueness of the username.
Despite my efforts, it seems that my current approach is not working as expected. Can you please help me identify what mistake I might be making?
The constructor in my SemanticSearch.java code is as follows:
public SemanticSearch() {}
The excerpt below executes after the email id validation:
In newuser.jsp, the relevant code snippet for this functionality is:
SemanticSearch myclass=new SemanticSearch();
boolean rets=myclass.searchForUsername(username);
if (rets==false)
{
alert("Username already exists");
document.getElementById("username").value="";
document.getElementById("password").value="";
document.getElementById("username").focus();
}
This function should be triggered during the click event of the adduser button. However, upon clicking, nothing appears to occur. Any assistance would be greatly appreciated.