Hi everyone i'm currently coding a web app and I encounter problems to set up the session attribute with a jstl variable.
In my app I display a list of objects "poster" using the jstl foreach tag. thus on the UI I have these list and i can drag and drop lines of the poster table in order to see a detailed version of the poster I choosed. here I need to get a variable "posterId" to pass it on a servlet (with session or wiht another method) here's my code:
<c:forEach var="poster" items="${listePosters}" varStatus="loop">
<tr data-sujets='${listeSujets[loop.index].titre}'
data-etat= '${listeValide[loop.index]}'
id="draggable-${loop.index}" draggable='true'
ondragstart="drag(event,${loop.index});"
onmouseout="fmouseup(${loop.index});"
ondragend="enddrag(event,${loop.index});"
onmousedown="fmousedown(${loop.index});"
onmouseup="fmouseup(${loop.index});"
onClick= "<c:set var="idPoster" value="${poster.idPoster}"
scope="session"/>;">
</tr>
</c:forEach>
so here I have 2 posters and in theory when I click on line with poster 1 session attribute should be set to 1 and when I click on line with poster 2 session attribute should be set to 2 I know my ${poster.idPoster}
get the right values because I did a window.alert()
instead of the c:set...
line and I get the right values so that's why I don't understand why session do not set up correctly
thank you in advance for your help