I'm trying to create an application for checking in and out devices. So far I've had success but I'm trying to have the main index.jsp page that is called display a message like "connecting" until a connection with the database can actually be made and then display the actual login form. So something to the effect of.
Connection con = null;
String driver = "com.mysql.jdbc.Driver";
Class.forName(driver).newInstance();
boolean connected = false;
while(!connected) {
try{
String url = "jdbc:mysql://localhost:3306/test";
con = DriverManager.getConnection(url,"username","password");
connected = true;
//Display form allowing user to authenticate login
} catch(Exception e) {
//Display Message "Attempting to connect to database"
}
}
The problem I have is the same message will get repeated over and over on the web page but i just want it to display once and stay there until the connection is found and then be removed and replace with the login form. Any thoughts?