Yeah, I struggled trying to figure this one out myself. This solution is better than what I came up with! But I do agree that it would be nice if it didn't require any config.
On Tue, 30 Sep 2003, Matt Raible wrote: > If you're using Tiles - this is the only solution that has been proposed > so far. Unfortunately, no one has thought of a better one. Tiles is > quite a beast since (most likely), the contentType of the response has > already been set when the first tile loads (i.e. the header). > Therefore, it's not possible for a child tile (i.e. the table) to change > that contentType. We are *always* open to new and better suggestions - > I'm just happy to see that someone has figured out at least ONE > solution. > > Matt > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dr. > Tolga Yalcinkaya > Sent: Monday, September 29, 2003 11:53 PM > To: [EMAIL PROTECTED] > Subject: Re: [displaytag-devel] Fix / hack for exports in an include > > > Is this (the filter) the only solution? This really breaks a very nice > > feature of the display taglib: no config needed! I don't have an > answer but if we can get this done without the filter, I think it would > > be a much better solution. > > Just my 2 cents! > > > Andy Pruitt wrote: > > >>This shouldn't be hard to add this filter to the code base and then > >>suggest adding the settings to web.xml when using Tiles. > >> > >> > >> > > > >The filter is also necessary anytime your JSP page is included in > >another page; it looks like some/many (I'm using Jetty) containers will > > >not let an included page reset the content type, and you won't be able > >to clear the already write()'d content. > > > >Here are the files w/ displaytag packages. TableTag#writeExport should > > >add > > > > > >pageContext.getRequest().setAttribute(org.displaytag.util.ResponseOverr > >i > >deFilter.CONTENT_OVERRIDE_TYPE, pMimeType); > > > >pageContext.getRequest().setAttribute(org.displaytag.util.ResponseOverr > >i > >deFilter.CONTENT_OVERRIDE_BODY, pExportString); > > > >at line 867. > > > > > > > >>Thanks! > >> > >>Matt > >> > >>On Monday, September 29, 2003, at 10:17 AM, Andy Pruitt wrote: > >> > >> > >> > >>>Ok, here is a fix for the dreaded "no export in tiles or included > >>>jsps" problem. > >>> > >>>This fix allows exports to work seamlessly, without > >>> > >>> > >>requiring the JSP > >> > >> > >>>author to duplicate the table tag, although it does require > >>> > >>> > >>a filter > >> > >> > >>>to be added to web.xml. > >>> > >>>The trick is that I changed the writeExport() method of TableTag to > >>>write the output into the Request object instead of to the page. A > >>>filter then checks for overriding content, and if content is present > >>>the > >>>filter will dump the page response and substitute in the overriding > >>>content. > >>> > >>>It's a hack, but it works. > >>> > >>> > >>> > >>> > >>>Change display.tld: > >>> <tag> > >>> <name>table</name> > >>> <tagclass>com.backstopsolutions.web.TableTag</tagclass> > >>><!-- <tagclass>org.displaytag.tags.TableTag</tagclass>--> > >>> > >>> > >>>To your web.xml: > >>> <filter> > >>> <filter-name>ResponseOverrideFilter</filter-name> > >>> > >>><filter-class>com.backstopsolutions.web.ResponseOverrideFilter</ > >>>filter-c > >>>lass> > >>> </filter> > >>> <filter-mapping> > >>> <filter-name>ResponseOverrideFilter</filter-name> > >>> <url-pattern>*.do</url-pattern> > >>> </filter-mapping> > >>> <filter-mapping> > >>> <filter-name>ResponseOverrideFilter</filter-name> > >>> <url-pattern>*.jsp</url-pattern> > >>> </filter-mapping> > >>> > >>> > >>> > >>> > >>>---andy pruitt > >>> > >>> > >>> > >><TableTag.java><BufferedResponseWrapper.java><ResponseOverrideFilter.j > >> > >> > >>>a > >>>va> > >>> > >>> > >> > >>------------------------------------------------------- > >>This sf.net email is sponsored by:ThinkGeek > >>Welcome to geek heaven. > >>http://thinkgeek.com/sf > >>_______________________________________________ > >>displaytag-devel mailing list [EMAIL PROTECTED] > >>https://lists.sourceforge.net/lists/listinfo/displaytag-devel > >> > >> > >> > > > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf _______________________________________________ > displaytag-devel mailing list [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/displaytag-devel > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > displaytag-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/displaytag-devel > -- John York Software Engineer CareerSite Corporation ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ displaytag-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/displaytag-devel
