0

my app is cosist:

index.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:p="http://primefaces.org/ui">

<h:head>
    <title>Date Input of Users</title>
</h:head>

<body>

    <p:fieldset legend="name of home">

        <!-- form to insert a user data -->
        <h:form>

            <b>name of User:</b>
            <h:inputText value="#{home.name}"/><br/>

            <p:commandButton action="#{home.res}" ajax="false"      
                value="Save" />                                         <!-- button to save --> 
            <p />

        </h:form>


    </p:fieldset>

</body>

</html>

my bean is ->

package prova;

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

@SessionScoped
@ManagedBean

public class Home {

    //fields
    private String name;

    public String getName() {
        return name;
    }

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

    //change a page
    public String res(){
        return ("results");
    }
}

but when click a button of save , my server tomcat return a error and not a page the error is:

javax.el.PropertyNotFoundException: Target Unreachable, identifier 'home' resolved to null

thanks all and sorry of my english

Jens
  • 67,715
  • 15
  • 98
  • 113
Bonni
  • 41
  • 2
  • 10
  • Looks like your bean is not instatiated correctly. Try to add a constructor with no Parameter. – Jens Mar 16 '15 at 12:02
  • create a costructor -> public home(){} ... but error persist T.T... not change errors T.T – Bonni Mar 16 '15 at 12:10

1 Answers1

0

Change the import of that bean to:

javax.faces.bean.ManagedBean;

See also:

Community
  • 1
  • 1
Stefan
  • 12,108
  • 5
  • 47
  • 66
  • thanks :) ... now fuction ... thanks senpai :) – Bonni Mar 16 '15 at 12:29
  • While this code snippet may solve the question, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. – Bono Mar 16 '15 at 12:54
  • okay sorry ... my problem is connect to error of import path ... correct to path of import -> application run – Bonni Mar 16 '15 at 13:35