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)