Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8454485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:02:41+00:00 2026-06-10T12:02:41+00:00

I can’t get it to work. i get the following: Unable to find matching

  • 0

I can’t get it to work. i get the following:

Unable to find matching navigation case with from-view-id '/login.xhtml' for action '#{admin.Validity}' with outcome 'failure'

this is the code i’m using:

HTML:

<div id="main" >

        <h:form id="login_form">
            <table>
                <tr>
                    <td><h:outputText value="User: " /></td>
                    <td><h:inputText id="username"
                            value="#{admin.username}" /></td>
                </tr>
                <tr>
                    <td><h:outputText value="Password: " /></td>
                    <td><h:inputSecret id="password"
                            value="#{admin.password}" /></td>
                </tr>
                <tr>
                    <td></td>
                    <td><h:commandButton value="Login" type="submit"
                            action="#{admin.Validity}" /></td>
                </tr>
            </table>
        </h:form>

    </div>

Admin.java

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;


@ManagedBean(name="admin")
@SessionScoped
public class Admin implements Serializable {
/**
 * 
 */
private static final long serialVersionUID = 1L;
Boolean authenticated;
String username;
String password;

public String getUsername() {
    return username;
}
public void setUsername(String username) {
    this.username = username;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}

public String Validity() {
    if(username.equals("admin") && password.equals("admin")) {
        authenticated=true;
        return "success";
    }   else   {
        authenticated=false;
        return "failure";
    }
}

}

faces-config.xml

<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

<navigation-rule>
    <from-view-id>/login.xhtml</from-view-id>

    <navigation-case>
       <from-action>#{Admin.Validity}</from-action>
       <from-outcome>success</from-outcome>
       <to-view-id>/main.xhtml</to-view-id>
       <redirect/>
    </navigation-case>

    <navigation-case>
        <from-action>#{Admin.Validity}</from-action>
        <from-outcome>failure</from-outcome>
        <to-view-id>/login.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>
</faces-config>

thank you.
Y

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:02:42+00:00Added an answer on June 10, 2026 at 12:02 pm

    Your managed bean is named #{admin},

    @ManagedBean(name="admin")
    

    however you attempted to access it as #{Admin} in the navigation case,

    <from-action>#{Admin.Validity}</from-action>
    

    so it definitely won’t work. Java is case sensitive.

    Fix the managed bean name in the navigation case accordingly:

    <from-action>#{admin.Validity}</from-action>
    

    Unrelated to the concrete problem, you’ve several minor design mistakes.

    1. Managed bean name already defaults to the classname with 1st character lowercased. So your @ManagedBean(name="admin") can just be replaced by @ManagedBean.

      @ManagedBean
      @SessionScoped
      public class Admin implements Serializable {
      
    2. Method names should not start with uppercase. Replace Validity() by validity(). Further there’s also a grammatical/language mistake in the method name, but that’s probably the language barrier. You’d normally have named it validate() or in this context better authenticate() or something.

    3. Navigation cases are soo JSF 1.x. Since JSF 2.0 you can utilize the new “implicit navigation” feature. You can use the outcome value as mapping/extension-less view ID.

      public String authenticate() {
          if (username.equals("admin") && password.equals("admin")) {
              authenticated=true;
              return "main";
          } else {
              authenticated=false;
              return "login";
          }
      }
      

      This way you can remove the whole <navigation-rule> block altogether.

    See also:

    • Communication in JSF 2.0
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can find why i get this error can someone help? package Android.data; public class
Can anyone help me trying to find out why this doesn't work. The brushes
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can any one tell, how to get the result of LINQ query contains group
Can we change the default action of the edit selected row button? Here is
Can someone thoroughly explain the last line of the following code: def myMethod(self): #
Can anyone give me an example of how to return the following json simply
Can anybody tell what is the best(easy) way to sort the following string 'index'
Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object
Can somebody help me construct this regular expression, please... Given the following strings... "April

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.