Check email address is unique to the system
I have a jsp page where the user enters their email address and p开发者_如何学Goassword. I am storing the email and password in a database. My problem is that I want to enter the data only if it is unique to the system. I mean the email address should be unique. Duplicates are not allowed. I cannot change the database where the email field is not unique.
Thanks Romi
It is very simple: just try to find given email in database, if it exists it means duplicate. You can create dedicated controller that does this check and make AJAX call to that controller from client side, to make you application more responsive;
Just query database table for entered e-mail, if it returns a result then do not insert that e-mail and warn user that he should enter something else.
精彩评论