tags:

views:

135

answers:

1

When you enable "export" from Displaytag, the tag code gives you links with special magic parameters that the tag recognizes as indicators that the table contents should be exported (as CSV, Excel, whatever). Well I'm interested in detecting the media type so that (for example) I can exclude columns that make no sense in an export (embedded action buttons, for one thing, or checkboxes for row selection).

I suppose I could write a table decorator and use that to stick the media type on the request, but it'd be nice to avoid that if the tag already does it. The documentation is not clear on the subject; I guess I can start digging through the source code too.

+1  A: 

No idea since I don't use Displaytag, but for further debugging, it may be good to know that you could just display all of those attributes by plain printing ${pageScope} and ${requestScope} or by looping over them as if it's a Map using JSTL c:forEach.

<c:forEach items="${requestScope}" var="entry">
    ${entry.key} = ${entry.value}<br>
</c:forEach>

That may nail down the Displaytag attribute of interest.

BalusC
Thanks again! There's indeed a page-scoped variable called "mediaType". Also, while poking around the documentation some more I was reminded that the "column" tag already accepts a "media" attribute that dictates what media types are appropriate for the column.
Pointy