Laura Vigna wrote: > Is there ANY way different than this one to do the job: > > <% int i = 0; %> > <c:forEach items="${tablesList}" var="table"> > <% request.setAttribute("table", > ((ArrayList)request.getAttribute("tablesList")).get(i++)); %> > <display:table name="table"> > </display:table> > <br> > </c:forEach>
You can certainly avoid the <% request %> bit with <c:set>, something like: <c:set var="table" value="${tablesList}" /> That set tag defaults to, I *think*, the request scope, but maybe to the pageContext? Can't remember for sure. Give it a try. But overall, you don't need the List.get(i++) call on there, even in the construct you have. You're kind of duplicating effort. The <c:forEach> iterates the tablesList, getting each item and setting it as a request (or pageContext? Again, not sure, experiment) attribute with the var name, in this case table. I think displaytag will grab it properly without doing the explicit set, but I'm not sure. So something like this may work: <c:forEach items="${tablesList}" var="table"> <display:table name="table"> </display:table> <br> </c:forEach> You can try inserting a speck of code between the forEach and the display to just print out all of the attributes in the pageContext and request scopes (you can do session and application also, but they're not there, I can at least guarantee that :^), and that should tell you what's living there at each point in the lifecycle: <c:forEach items="${tablesList}" var="table"> <% Enumeration<String> attributes = request.getAttributeNames(); for(String attribute : attributes) { out.println(attribute + ": " + request.getAttribute(attribute) + "<br/>\n"); } %> <display:table name="table"> </display:table> <br> </c:forEach> It's hideous, both in code and output, but it's just for debugging :) Let me know if these changes work for you or if you have any other questions. > because we want to avoid inserting java code in the jsp. > Is it possible to do it with the expression language, or is there any > function provided > by the display tag library? Or maybe using the decorators... > Thanks so much in advance for ANY hint! > > Laura Vigna > Junior Java Developer > Happy Coding! > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > displaytag-user mailing list > displaytag-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/displaytag-user > -- Rick Herrick [EMAIL PROTECTED] I haven't got time for inner peace. "No reasonable definition of reality could be expected to permit this."--Albert Einstein, Boris Podolsky and Nathan Rosen in 1935 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user