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";

    }
}
4

0 に答える 0