I want to use the actual item from my c:forEach in a <% JavaCode/JSPCode %>.
How do I access to this item?
<c:forEach var="item" items="${list}">
<% MyProduct p = (MyProduct) ${item}; %> <--- ???
</c:forEach>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Don’t use scriptlets (ie. the stuff in between the
<% %>tags. It’s considered bad practice because it encourages putting too much code, even business logic, in a view context. Instead, stick to JSTL and EL expressions exclusively. Try this: