I have been looking how to do this properly but cannot find a definitive guide on how to do with.
I know that you cannot use an expression within the tag, but I am unsure how else I am meant to approach it.
I've seen a multitude of answers for this without much explanation or help.
Essentially I want something like the following to work, but obviously doesn't.
<c:forEach items="${dataposition.rows}" var="lineposition" begin="0" varStatus="status">
<c:set var="name_${status.count}" value="${lineposition.value}" scope="session"/>
</c:forEach>
The exact error message is
"According to TLD or attribute durective in tag file, attribute var does not accept any expressions"
What is the proper way to accomplish this?
(I changed the variable names from my actual code, but hopefully you still get the idea)
If I need to create java objects or something I am fine with that, but I would need to know how to include them in my project and how to use them within the code. Something like a list sounds about right.
I have created an object to hold my values for me.
<jsp:useBean id="myid" class="myclass" scope="session"/>
and I want to use it, but am unsure how:
<c:forEach items="${dataposition.rows}" var="lineposition" begin="0" varStatus="status">
<%
myid.add_position(lineposition.var1, lineposition.var2, lineposition.var3, lineposition.var4, lineposition.var5);
%>
</c:forEach>