0

I have got a problem and i didnt find question anywhere.

My index.xhtml page is :

<?xml version='1.0' encoding='UTF-8' ?>
<!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://java.sun.com/jsf/html">
<h:head>
    <title>Facelet Title</title>
</h:head>
<h:body>

    <h:form>
        <h:outputText value="Enter product name"/>
        <h:inputText value="#{user.name}" /> <br/>
        <h:outputText value="Enter qty"/>
        <h:inputText value="#{user.qty}" /> <br/>
        <h:outputText value="Enter price"/>
        <h:inputText value="#{user.price}" /> <br/>
        <h:commandButton value="Add item" action="#{user.add}" />
    </h:form>

</h:body>

User.java page is :

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;


@ManagedBean 
@RequestScoped
public class User {
private String name;
private int qty;
private double price;


public String getName() {
    return name;
}

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

public int getQty() {
    return qty;
}

public void setQty(int qty) {
    this.qty = qty;
}

public double getPrice() {
    return price;
}

public void setPrice(double price) {
    this.price = price;
}

public String add(){
    System.out.println("product inserted..");
    System.out.println(this.name+" "+this.qty+" "+this.price);
    return "Success";
}

}

and when i run it /index.xhtml @12,48 value="#{obj.name}": Target Unreachable, identifier 'obj' resolved to null error accured . Please help me. (glassfish 4.1)

  • 1
    Possible duplicate of [Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable](https://stackoverflow.com/questions/30128395/identifying-and-solving-javax-el-propertynotfoundexception-target-unreachable) – Selaron Apr 04 '19 at 04:37
  • Please learn to post errors in searchengines and, well, search... – Kukeltje Apr 04 '19 at 08:22
  • I know how can i search error in searchengine but anyone didnt result my error – osmanerol Apr 04 '19 at 10:56

0 Answers0