As I can see, you are comparing the message with the empty string using ==.
Its very hard to write the full code, but I can tell the flow of code -
first, create db class & method inide that which will return the connection.
second, create a servelet(ex-login.java) & import that db class onto that servlet.
third, create instance of imported db class with the help of new operator & call the connection method of that db class.
fourth, creaet prepared statement & execute statement & put this code in try catch block for exception handling.Use if-else condition in the try block to navigate your login page based on success or failure.
I hope, it will help you. If any problem, then please revert.
Nikhil Pahariya