Question

I have been googling and found that I can remove a session attribute using:

<c:remove var="foo" />

What I want is to clear all session attributes from a JSP, something like this:

<c:forEach  var="item" items="${sessionScope}">
    <c:remove var="${item }" scope="session"/>
</c:forEach>    

The problem is that the code from above gives me this warning

c:remove doesn't support runtime expression

And I can't view the JSP where I put the code.

Is it possible? Is it a good practice to do something like this?

Était-ce utile?

La solution

Because your are iterating through "item" and while iterating it inside loop you are trying to delete.

Better do this logic in java only rather than JSP

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top