javax.el.PropertyNotFoundException: Property 'id' not found on type model.Grocery
<p>I am making a page where you are able to update,edit,delete,insert data in a database. The insert page works well, and the data is inserted successfully, but when i click the "Add" button i am not redirected to the AllGrocery page but i am given this error by Eclipse.Can't figure out where the problem is.Can anyone help me out? Database : GroceryStore, Table : grocerys(id,name,price)</p>

<p>DataAccess.java</p>

<pre><code>package dao;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;

import com.sun.istack.internal.logging.Logger;

import db.DBUtils;
import model.Grocery;

public class DataAccess {

    public void addNew(Grocery g) throws ClassNotFoundException, SQLException{
        try {
        PreparedStatement ps = DBUtils.getPreparedStatement("insert into grocerys values(?,?,?)");
        ps.setInt(1, g.getID());
        ps.setString(2, g.getName());
        ps.setDouble(3, g.getPrice());

        ps.executeUpdate();

        } catch(ClassNotFoundException | SQLException ex){

        }
    }

    public static List&lt;Grocery&gt; getAll(){
        List&lt;Grocery&gt; gs = new LinkedList&lt;&gt;();

        try {
            ResultSet rs = DBUtils.getPreparedStatement("select * from grocerys").executeQuery();

            while (rs.next()){
                Grocery g = new Grocery();
                g.setID(rs.getInt(1));
                g.setName(rs.getString(2));
                g.setPrice(rs.getDouble(3));

                gs.add(g);
            }

        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return gs;
    }
}
</code></pre>

<p>DBUtils.java</p>

<pre><code>package db;

import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Connection;
import java.sql.SQLException;

public class DBUtils {

    public static PreparedStatement getPreparedStatement(String sql) throws ClassNotFoundException, SQLException{

        PreparedStatement ps = null;

        Class.forName("com.mysql.jdbc.Driver");

        String url = "jdbc:mysql://localhost:3306/GroceryStore";
        String user = "root";
        String pass = "adil";

        Connection conn = DriverManager.getConnection(url,user,pass);

        ps = conn.prepareStatement(sql);


        return ps;

    }

    public static void main(String[] args)throws ClassNotFoundException, SQLException {

        getPreparedStatement("select * from grocerys");

    }

}
</code></pre>

<p>Grocery.java</p>

<pre><code>package model;

public class Grocery {

    private int id;
    private String name;
    private Double price;

    public void setID(int id_){
        id = id_;
    }

    public void setName(String name_){
        name = name_;
    }

    public void setPrice(Double price_){
        price = price_;
    }

    public int getID(){
        return id;
    }

    public String getName(){
        return name;
    }

    public Double getPrice(){
        return price;
    }

}
</code></pre>

<p>AllGrocery.java</p>

<pre><code>package servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.DataAccess;

/**
 * Servlet implementation class AllGrocery
 */
@WebServlet("/AllGrocery")
public class AllGrocery extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public AllGrocery() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setAttribute("AllGrocery", DataAccess.getAll());

        RequestDispatcher rd = request.getRequestDispatcher("AllGrocery.jsp");

        rd.forward(request, response);



    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

}


        public Double getPrice(){
            return price;
        }

    }
</code></pre>

<p>AddNew.html</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="ISO-8859-1"&gt;
&lt;title&gt;Add Grocery&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;h1&gt;Add New Grocery&lt;/h1&gt;
&lt;form action = "ManagerAddNew.jsp" method = "post"&gt;
&lt;table&gt;

&lt;tr&gt;
&lt;th&gt;ID&lt;/th&gt;
&lt;td&gt;&lt;input type = "number" name = "id" style = "width : 200px;"/&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;th&gt;NAME&lt;/th&gt;
&lt;td&gt;&lt;input type = "text" name = "name" style = "width : 200px;"/&gt;&lt;/td&gt;
&lt;/tr&gt;


&lt;tr&gt;
&lt;th&gt;PRICE&lt;/th&gt;
&lt;td&gt;&lt;input type = "number" name = "price" style = "width : 200px;"/&gt;&lt;/td&gt;
&lt;/tr&gt;


&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;td&gt;&lt;input type = "submit" name = "submit" value = "ADD"/&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>AllGrocery.jsp</p>

<pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%&gt;

    &lt;%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
&lt;title&gt;Grocerys Available&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;div syle = "width : 1200px; margin-left:auto;margin-right:auto;"&gt;

&lt;table cellpadding = "10"&gt;

&lt;tr&gt;

&lt;th&gt;ID&lt;/th&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;

&lt;/tr&gt;

&lt;c:forEach items = "${AllGrocery}" var = "p"&gt;

&lt;tr&gt;
&lt;td&gt;${p.id}&lt;/td&gt;
&lt;td&gt;${p.name}&lt;/td&gt;
&lt;td&gt;${p.price}&lt;/td&gt;
&lt;td&gt;

&lt;a href = "edit?id = ${p.id}"&gt;Edit&lt;/a&gt;
&lt;a href = "delete?id = ${p.id}"&gt;Delete&lt;/a&gt;

&lt;/td&gt;
&lt;/tr&gt;


&lt;/c:forEach&gt;

&lt;/table&gt;

&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>ManagerAddNew.jsp</p>

<pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%&gt;

    &lt;%@ page import = "model.Grocery" %&gt;
    &lt;%@ page import = "dao.DataAccess" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
&lt;title&gt;Insert title here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;%

String name = request.getParameter("name");
int id = Integer.parseInt(request.getParameter("id"));
Double price = Double.parseDouble(request.getParameter("price"));

Grocery g = new Grocery();
g.setID(id);
g.setName(name);
g.setPrice(price);

DataAccess da = new DataAccess();

da.addNew(g);

response.sendRedirect("/SimpleServletProject/AllGrocery");

%&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Error :</p>

<pre><code>org.apache.jasper.JasperException: An exception occurred processing JSP page /AllGrocery.jsp at line 29

26: &lt;c:forEach items = "${AllGrocery}" var = "p"&gt;
27: 
28: &lt;tr&gt;
29: &lt;td&gt;${p.id}&lt;/td&gt;
30: &lt;td&gt;${p.name}&lt;/td&gt;
31: &lt;td&gt;${p.price}&lt;/td&gt;
32: &lt;td&gt;


Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    servlet.AllGrocery.doGet(AllGrocery.java:38)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


root cause 

javax.el.PropertyNotFoundException: Property 'id' not found on type model.Grocery
    javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:290)
    javax.el.BeanELResolver$BeanProperties.access$300(BeanELResolver.java:243)
    javax.el.BeanELResolver.property(BeanELResolver.java:377)
    javax.el.BeanELResolver.getValue(BeanELResolver.java:97)
    org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:104)
    org.apache.el.parser.AstValue.getValue(AstValue.java:184)
    org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:950)
    org.apache.jsp.AllGrocery_jsp._jspx_meth_c_005fout_005f0(AllGrocery_jsp.java:215)
    org.apache.jsp.AllGrocery_jsp._jspx_meth_c_005fforEach_005f0(AllGrocery_jsp.java:163)
    org.apache.jsp.AllGrocery_jsp._jspService(AllGrocery_jsp.java:113)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    servlet.AllGrocery.doGet(AllGrocery.java:38)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
</code></pre>