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 8261363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:22:49+00:00 2026-06-08T03:22:49+00:00

I’m trying to create a simple login page that accesses a DB so that

  • 0

I’m trying to create a simple login page that accesses a DB so that when username and password are validated, the id, firstName, lastName are set within the class as well for access. I get this error though:

javax.servlet.ServletException: Unable to create managed bean UserBean.  The following problems were found:
 - Property firstName for managed bean UserBean does not exist.  Check that appropriate getter and/or setter methods exist.
 - Property id for managed bean UserBean does not exist.  Check that appropriate getter and/or setter methods exist.
 - Property lastName for managed bean UserBean does not exist.  Check that appropriate getter and/or setter methods exist.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)

I have getters for id, firstName, lastName but no setters because they are set after validation.

Here is class UserBean

public class UserBean {
private static String password, username, id, firstName, lastName;
public enum DBfields { BLANK, USERNAME, ID, PASSWORD, FIRSTNAME, LASTNAME }; 

public String getPassword() {
    return password;
}

public void setPassword( String value ) {
    password = value;
}

public String getUsername() {
    return username;
}

public void setUsername( String value ) {
    username = value;
}

public static String getId() {
    return id;
}

public static String getFirstname() {
    return firstName;
}

public static String getLastname() {
    return lastName;
}

public String loginUser() throws Exception { 

    if( loginValidate( username, password ) )
        return "success";
    else
        return "fail";
}

public static boolean loginValidate( String username, String Password ) throws Exception{

    String DBuser;
    String DBpass = "asdf";
    PreparedStatement table = connectToTable( "firstsql", "users");
    ResultSet row = table.executeQuery();;

    while(row.next()){
        DBuser = row.getString(DBfields.USERNAME.name());
        if(username.equals(DBuser)){
            DBpass = row.getString(DBfields.PASSWORD.name());
            break;
        }
    }

    if(password.equals(DBpass)){
        id = row.getString(DBfields.ID.name());
        firstName = row.getString(DBfields.FIRSTNAME.name());
        lastName = row.getString(DBfields.LASTNAME.name());
        return true;
    } else
        return false;
}

and my faces-config

 <?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xi="http://www.w3.org/2001/XInclude"
 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">
 <managed-bean>
  <managed-bean-name>UserBean</managed-bean-name>
  <managed-bean-class>com.jfsdemo.bean.UserBean</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
  <managed-property>
   <property-name>firstName</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
  <managed-property>
   <property-name>id</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
  <managed-property>
   <property-name>lastName</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
  <managed-property>
   <property-name>password</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
  <managed-property>
   <property-name>username</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
 </managed-bean>
 <navigation-rule>
  <from-view-id>/login.xhtml</from-view-id>
  <navigation-case>
   <from-action>#{UserBean.loginUser}</from-action>
   <from-outcome>success</from-outcome>
   <to-view-id>/timesheet.xhtml</to-view-id>
  </navigation-case>
  <navigation-case>
   <from-action>#{UserBean.loginUser}</from-action>
   <from-outcome>fail</from-outcome>
   <to-view-id>/login.xhtml</to-view-id>
  </navigation-case>
 </navigation-rule>
 <navigation-rule>
  <from-view-id>/timesheet.xhtml</from-view-id>
 </navigation-rule>
</faces-config>
  • 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-08T03:22:52+00:00Added an answer on June 8, 2026 at 3:22 am

    Managed properties are set through the setters. So you really need to provide them. Also note that Java is case sensitive. Your first and last name properties are based on the getter names called firstname and lastname instead of firstName and lastName as expected by faces-config.xml. Fix it accordingly. Use getFirstName() and setFirstName() instead of getFirstname() and so on. Or, better, just have your IDE autogenerate the getters/setters based on properties.

    By the way, why are those properties declared static? This way they will be shared across all users which are using the webapp. Is this really what you want?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.