0

I have make web project in eclpise ide with jsf pages. I have configured faces-config.xml for navigation rule. After checking inputet username and password page is still same. I am using tomcat version 7.

my faces-config.xml

<managed-bean>
    <managed-bean-name>loginAdmin</managed-bean-name>
    <managed-bean-class>logovanje.LoginAdmin</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<navigation-rule>
    <description>Loging Admin</description>
    <from-view-id>/loginAdmin.jsp</from-view-id>
    <navigation-case>
        <from-action>#{loginAdmin.proveraSifreAdmina}</from-action>
        <from-outcome>valid</from-outcome>
        <to-view-id>/adminPage.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-action>#{loginAdmin.proveraSifreAdmina}</from-action>
        <from-outcome>invalid</from-outcome>
        <to-view-id>/loginUser.jsp</to-view-id>
    </navigation-case>
</navigation-rule>

</faces-config>

and my jsf file from where i am calling loginAdmin.proveraSifreAdmina

<f:view>

<h:form id="loginAdmin">
    <h:outputText value="Administrator: " />
    <h:inputText id="adminName" value="#{loginAdmin.adminName }"  required="true"/>
    <h:message for="adminName" id="adminNamePoruka" />
    <br>
    <h:outputText value="Sifra: " />
    <h:inputSecret id="password" value="#{loginAdmin.password }"  required="true"/>
    <h:message for="password" id="passwordPoruka"/>
    <br>
    <h:commandButton type="submit" value="Prijava" action="#{loginAdmin.proveraSifreAdmina }" />
    <h:commandButton value="resetuj" type="reset" />

</h:form>

</f:view>

and in my class i am returning String

public String proveraSifreAdmina() {

    getAdmin(adminName);
    System.out.println("ide");
    if(adminName.equals(dbadminName) && password.equals(dbpass)) {
        System.out.println("Saslje");
        return "valid";
    } else {
        System.out.println("isto salje");
        return "invalid";

    }
}
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 2
    Looks like you're learning JSF 1.2. Please update your resources to start learning at least JSF 2.0, or even better, start learning JSF 2.2. – Luiggi Mendoza Sep 16 '13 at 17:16
  • OK, but do you know why page wont change after validation user ? – user2784713 Sep 17 '13 at 09:33
  • I have found solution. I have make project with jsf 2.1 and in faces-config.xml file just deleted row #{loginAdmin.proveraSifreAdmina}. Can someone can tell me why is working now and not with row ? – user2784713 Sep 17 '13 at 10:41

0 Answers0