Target Unreachable, identifier resolved to null JSF 2.2 [closed]

kolossus

There's quite a bit wrong with your current code:

  1. You're using the wrong JSF annotations

  2. You're not using JSF-standard tags. Use:

    • <h:head/> instead of <head> (this is required for most ajax functionality in . Without it, the necessary javascript to support ajax cannot be included on the page
    • <h:body> instead of <body>

An HTTP-500 is indicative of an actual bug in your code.

Don't be afraid of 500 error code. just read stack trace carefully. there were some error in your code like Null Pointer Exception. please check this code ans tell the result.

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class User implements Serializable {

    private String name;
    private String password;
    private String greeting;

    /**
     * @return
     */
    public String getGreeting() {
        if (name == null ||name.length() == 0)
            return "";
        else
            return "Welcome to JSF2 + Ajax, " + name + "!";
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setGreeting(String greeting) {
        this.greeting = greeting;
    }

}

also please be careful about @kolossus answer and use standard jsf tags and annotations

Try to use different annotation

import javax.faces.bean.ManagedBean;

instead of Java EE 6's

import javax.annotation.ManagedBean;