jsp - JSTL while loop (without scriptlets) -
is there way create while loop structure jsp, without using scriptlet?
i ask have linked list-like structure (specifically, printing cause chain exceptions) afaik not have iterator interface use foreach on.
you iterating on list
<c:foreach var="entry" items="${requestscope['myerrorlist']}"> ${entry.message}<br/> </c:foreach>
edit:
you have method following transform exception , causes list later shown using foreach
public static list<throwable> getexceptionlist(exception ex) { list<throwable> causelist = new arraylist<throwable>(); causelist.add(ex); throwable cause = null; while ((cause = ex.getcause()) != null && !causelist.contains(cause)) { causelist.add(cause); } return causelist; }
for example:
try { ... } catch (... ex) { request.setattribute("myerrorlist", getexceptionlist(ex)); }
Comments
Post a Comment