0

List<Products>製品テーブルのデータを含む があります。サーブレットでこれを取得していList<Products>ます。次のコードで、このリストを JSP に渡しています。

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

そして、次のコードで JSP に LIST のデータを表示しています。

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

でもこう書くと

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

エラーが表示されます

javax.el.PropertyNotFoundException '価格' が見つかりません

なんで?

4

1 に答える 1

2

変化する

${emp.Price()}

${emp.price}
于 2014-05-12T19:56:57.683 に答える