Daniel Cricco wrote: > Great!!!! > > You also not need the line > > <c:set var="table" value="${table}" scope="request"/> > since > > <c:forEach> > > do it for you if you specify in: > > <c:forEach items="${tablesList}" var="table">
This is exactly correct. > BTW: > <c:set var="table" value="${table}" scope="request"/> is something like Collection table; > //put some data in table > table=table; > > It is not an error but it should be interpreted as a warning in your java compiler No, this isn't really how it works. <c:set> sets the variable as an attribute in one of the HTTP application scopes. So really your pseudocode works like: Collection someObject; //put some data in someObject request.setAttribute("table", someObject); There's no object within the actual programming scope called table unless you explicitly create one within a scriptlet. And you can stick things into the attribute cache with the same name repeatedly and never get a compiler warning or a run-time warning either for that matter. ALL of these tags work on attributes. Where the attributes are stored depends on the scope attribute. The default scope for <c:set> is page, while the default scope for displaytag is request, so you would need to specify scope for at least one of the tags for them to peacefully co-exist. Laura, in response to your earlier post: > <c:forEach items="${tablesList}" var="table"> > <% Enumeration<String> attributes = request.getAttributeNames(); > for(String attribute : attributes) > { > out.println(attribute + ": " + request.getAttribute(attribute) + > "<br/>\n"); > }%> > </c:forEach> > > doesn't work, I get error "Can only iterate over an array or an instance of > Java.lang.iterable" and as I don't know this type I didn't go further in trying but > I will (Enumeration - is it from old Java versions? I only know enum) Yeah, I was just typing that out, there's a couple of mistakes in there. First, to get the Enumeration<String> from the request.getAttributeNames() you'd need to cast it: Enumeration<String> attributes = (Enumeration<String>) request.getAttributeNames(); And even then you can't use for(:) with that. Which is an annoying thing about Enumerations, but there you are. Anyways, the Enumeration class has been in Java since the beginning in the java.util package. It's basically not even comparable to enum except in the most facile way, so forget all about that :) The proper way to do what I was showing you is this: Enumeration attributes = request.getAttributeNames(); while (attributes.hasMoreElements()) { String attribute = (String) attributes.nextElement(); String value = request.getAttribute(attribute); out.println(attribute + ": " + value + "<br/>\n"); } This is a useful little snippet of debugging code to keep handy whenever you're having trouble not finding something with a tag, such as in your case. You can use various scopes by calling the getAttributeNames() method from each object (request, session, application), or you can use a handy method on the pageContext object: pageContext.getAttributeNamesInScope(PageContext.PAGE_SCOPE) pageContext.getAttributeNamesInScope(PageContext.REQUEST_SCOPE) pageContext.getAttributeNamesInScope(PageContext.SESSION_SCOPE) pageContext.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE) These each return Enumerations containing the attribute names for that scope. There's a corresponding getAttribute() method too: pageContext.getAttribute("name", PageContext.PAGE_SCOPE); pageContext.getAttribute("name", PageContext.REQUEST_SCOPE); pageContext.getAttribute("name", PageContext.SESSION_SCOPE); pageContext.getAttribute("name", PageContext.APPLICATION_SCOPE); -- 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