Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL and collection manipulations  RSS feed

 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry to post such a basic question, but have been searching everywhere and can't find anything.

I have a tag that is grabbing a collection, and setting as a variable on the page. I can correctly use c:forEach to iterate through the elements like this:

<c:forEach var = "st" items ="${sts}" varStatus="status">
<c:if test ="${(st.value == 'TEST')}">
</c:if>
</c:forEach>

Is it possible to delete the "st" element in the <c:if> from the "sts" collection since it is being set on the page? If so, what is the syntax.

Thanks-
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to accomplish?
 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If if the test condition is met, removing the element being tested from the collection.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, that is not in the realm of display control so there is no facility to do so from the JSTL or EL. Why are you not handling this in the controller?
 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought about that initially, but since the collection itself was being set in a tag, I thought I might be able to manipulate it using JSTL. I was trying to avoid changing the tag-because that would cause a ripple effect on other parts of the code.

I'll think about this some more.

Thanks Bear!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!