Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
I am learning JSF and i decided to do a login with the help of a text file, now i am faced with this problem. when i click the login button on the JSF page, nothing happens.... i would like to know why

THIS IS MY JSF LOGIN PAGE
Java
<pre lang="HTML"> <h:form>
    <p>Please type your user name: 
    <h:inputText size="15" value="#{register.username}"/> </p>
    <p>Please type your password: 
    <h:inputText size="15" value="#{register.password}" />
<pre lang="xml"><h:outputLabel value="#{register.Error}"/></p>
    <p>
        <h:commandButton action="#{register.read()}" value="Submit"/>
    <h:commandButton type="reset" value="Reset"/></p>
        </h:form>     

<pre lang="text">HERE IS MY METHOD FROM THE "register" MANAGED BEAN


Java
public void read(){

        try{

                FileInputStream fstream = new FileInputStream(filepath);
                DataInputStream in = new DataInputStream(fstream);
                BufferedReader br = new BufferedReader(new InputStreamReader(in));
                String strLine;
                String strLine2;
                strLine = br.readLine();
                user=strLine;

      while ((strLine2 = br.readLine()) != null)   {

               pass=strLine2;

  }

  in.close();

    }catch (Exception e){
  System.err.println("Error: " + e.getMessage());
  }

  }


AND THIS MY VALIDATION METHOD

public void validateUser(){

       if(user == null ? username == null : user.equals(username)) {

           validatePass();

       }
       else{

            Error="incorrect username";
       }

    }

    public void validatePass(){

    if( pass.equals(password)){

                    success();
           }
           else{
               Error= "incorrect password"
           }
}
Posted
Updated 20-Oct-14 5:31am
v7
Comments
OriginalGriff 20-Oct-14 11:12am    
Probably because you are SHOUTING AT IT.

DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalization if you want to be taken seriously.
morojele 20-Oct-14 11:19am    
Sorry for that....that was not the intension

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900