0

I have a List<Products> which contains data of my products table. On a servlet I am getting this List<Products>. I am passing this list to JSP by following code:

List<Products>Products=new SessionBeanClass().DisplayProducts(arr);
request.setAttribute("Products",Products);
request.getRequestDispatcher("sample2.jsp").forward(request, response);

And I am displaying data of LIST on JSP by following code:

<c:forEach items="${requestScope['Products']}" var="emp" >
    <table>
        <tr>
            <td>  ${emp.getPrice()} </td>
        </tr>
    </table>
</c:forEach>

But when I write like this

<c:forEach items="${requestScope['Products']}" var="emp" >
    <table>
        <tr>
            <td>  ${emp.Price()} </td>
        </tr>
    </table>
</c:forEach>

It shows me an error

javax.el.PropertyNotFoundException 'Price' not found

Why?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
TechChain
  • 8,404
  • 29
  • 103
  • 228

1 Answers1

2

change

${emp.Price()}

to

${emp.price}
jmj
  • 237,923
  • 42
  • 401
  • 438