I want to print decremental numbers like:
... ${i} ...
then I got jsp exception:
javax.servlet.jsp.JspTagException: 'step' <= 0
javax.servlet.jsp.jstl.core.LoopTagSupport.validateStep(LoopTagSupport.java:459)
org.apache.taglibs.standard.tag.rt.core.ForEachTag.setStep(ForEachTag.java:60)
....
but this answer says it is possible to loop in both ways:
What's wrong with me?
解决方案
I am not sure how the answerer of the other question got it to work, but I can't get it to work here with the reference JSTL implementation.
Anyway, you can achieve the requirement with following:
... ${10 - i} ...
Or if you'd like to avoid duplication of 10:
... ${loop.end - i + loop.begin} ...