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

  • SEARCH
  • Home
  • 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 7628755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:39:18+00:00 2026-05-31T05:39:18+00:00

i’m trying to implement a very basic (at this point) login screen with JSF

  • 0

i’m trying to implement a very basic (at this point) login screen with JSF 2 (using NetBeans). i’ve found several examples, from which i copied the source code, but so far unsuccessfully.
in my login.xhtml file i have a 2 input fields and a command button –

<h:commandButton value="go!" actionListener="#{LoginBean.CheckValidUser}" />

in my LoginBean, the validation function looks like this –

public String CheckValidUser() { 
    if(username.equals("admin") && password.equals("admin")){ 
        return "welcome"; 
    } 
    else{ 
       return "fail";
    } 
} 

and to my faces-config.xml i’ve added the following navigation rule:

<navigation-rule>
    <description>login success</description>
    <from-view-id>/login.xhtml</from-view-id>
    <navigation-case>
        <from-action>#{LoginBean.CheckValidUser}</from-action> 
        <from-outcome>welcome</from-outcome>
        <to-view-id>/welcome.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>

anyhow – i just won’t work, i enter the correct UN and PW but i don’t get to ‘welcome.xhmtl’. when i debug the code, i see in the validation function it works as expected, but i can i know that the faces-config.xml is configured correctly?

what did i miss?
cheers,
eRez

  • 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-05-31T05:39:19+00:00Added an answer on May 31, 2026 at 5:39 am

    Here,

    <h:commandButton value="go!" actionListener="#{LoginBean.CheckValidUser}" />
    

    You should be using action instead of actionListener. Fix it accordingly:

    <h:commandButton value="go!" action="#{LoginBean.CheckValidUser}" />
    

    Action listeners are supposed to return void and they are not intented to navigate.

    See also:

    • Differences between action and actionListener

    Unrelated to the concrete problem, remove the <navigation-rule> altogether. It’s unnecessary since JSF 2.0 with the new Implicit Navigation support. An outcome of "welcome" will implicitly go to "welcome.xhtml" already. Make sure that you’re reading JSF 2.x targeted resources/books/tutorials and not JSF 1.x ones. JSF 2.x is a major change as compared to JSF 1.x.

    See also:

    • Our JSF tag wiki page
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.