Login button - click twice

I have a login page with username, password and a login button. Everytime I deploy the application, I have to click the login button twice to get the loginButton_action to fire.Anybody have an idea how to get that down to one click?
[246 byte] By [Miland] at [2007-11-26 8:08:56]
# 1
Should take only one click. Would you mind posting your code? Does this problem occur in all browsers or only one in particular?
Tosa_Developer at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...
# 2

It happens in both IE and FireFox. Here's my code:

public String loginButton_action()

{

// TODO: Process the button click action. Return value is a navigation

// case name where null will return to the same page.

String loginName = (String) this.userNameTF.getText();

//lc.bind( ldapVersion, loginDN, password.getBytes("UTF8") );

String password = (String) this.passWordPF.getText();

//call Novell connect method to login to ldap.

try

{

// User u = NovellConnect.Connect(loginName, password);

//password.getBytes("UTF8");

Connect(loginName, password);

// display message if processing completes successfully

info("Hello " + this.userNameTF.getText() + ", you have been " +

"successfully authenticated.");

// Set the userName in SessionBean1

String userName = (String) userNameTF.getText();

getSessionBean1().setUserName(userName);

// Set the password in SessionBean1

String passWord = (String) passWordPF.getText();

getSessionBean1().setPassWord(passWord);

return "case1";

}//end try

catch (Exception e)

{

if (e.toString().equals("java.lang.SecurityException") || e.toString().equals("java.net.NoRouteToHostException"))

{

FacesContext facesContext = FacesContext.getCurrentInstance();

facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, " Problem connecting to Server. ", " "));

}// put some code in to warn user they are not authenticated.

else

{

System.out.println("error!" + e.toString());

}

// display message if processing completes unsuccessfully

info("Unsuccessful");

return "case2";

}

}

Miland at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...
# 3
Does case2 shows the login page again?Perhaps there is a runtime error in the try catch block the first time you click the login button.Throwing an exception inside the catch block (only to debug) could help.I磎 just taking my best guess
Victor_Munoz at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...
# 4
Case1 goes to successPage.jsp and Cas2 goes to unsuccessPage.jsp. I've tried to debug this many times but still have to click the login button twice before debug starts. :(
Miland at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...
# 5
Case1 goes to successPage.jsp and Cas2 goes to unsuccessPage.jsp. I've tried to debug this many times but still have to click the login button twice before debug starts. :(
Miland at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...
# 6

I am interested to know if you have to click twice before the login button's action method gets called or before the page will actually navigate to another page.

Can you put

log("action method called")

at the very top of your action method and look to see whether it shows up in the server log (right click the server node and choose view log to display output to the log) when you click the first button.

After you click the first button, wait a bit to allow time for the message to go to the log.

jetsons at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...
# 7
Thanks to everyone who responded to my post!I deleted the loginButton and recreated. Rebooted and now it's working correctly. Let's hope that the fix was really that simple.Message was edited by: Miland
Miland at 2007-7-6 20:57:04 > top of Java-index,Development Tools,Java Tools...