sort of, you'd still be constructing the DataSet in the Action, and displaytag would just be calling that.
not that this makes much of a difference. i think you can actually access the displaytag parameters from outside of displaytag. at the bottom of TableTag, there's a method called encodeParameter(), it uses the tag attribute 'id' to generate the encoded parameter. it uses a simple hash, which is why you see those numbers like 'p-231-d'. so if you know the tag attribute 'id' (which you should since its in your JSP), then in your action you can do the same thing as encodeParameter() to figure out what the parameters are. its a bit complicated, and it doesn't solve the whole problem, which is that displaytag uses the size of the list to figure out how many pages there are. i was playing around with a way to trick it, by creating a fake wrapper implementation of List that pretended it was the size of the whole data set, but actually only contained the pieces you wanted to display. i didn't finish it, but i think one could get it to work. but then this doesn't solve the problem of iterating over undisplayed rows. and since i'm dealing with around 200,000 rows, it would be kinda dumb to have this thing iterate over 199,980 fake rows just to display 20 real rows. so aside from coming up with ways to hack around it, i think the best thing to do is separate out the data section into an interface and provide a default implementation for lists. my earlier idea is one way to do it, but i imagine there could be others. --alex > Date: Fri, 16 Apr 2004 15:48:13 -0400 (EDT) > Subject: Re: [displaytag-devel] Accepting large datasets (was: why > From: "Chris Eldredge" <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Reply-To: [EMAIL PROTECTED] > > If you did that displaytag would be acting as the MVC, not Struts. > The logic you want to put into your DataSet belongs in the Action. What > is preventing that is displaytag likes to choose random unique identifiers > for parameters, making it pretty much impossible to have Struts populate > an ActionForm for you. > > The Struts Action should be getting a sorted page of information from the > persistence layer and exposing only that page to displaytag. > > What is missing is a way to make displaytag call your Action in an > intuitive way when the user clicks a sort button, or a page number. The > random integer is there to allow mutiple tables on the samge page. But an > alternative approach would be to have properties defining the paramId for > page, sort column and sort order. > > But displaytag is set up to do this all internally, so I imagine it wont > be a simple matter of adding a few more properties to the tld. Someone > spoke earlier of the problem of having modle and view integrated and I > think this is a pretty good example of how it makes it tough to extend. > > > well, the way i invision it is that for each type of table, you'd > > implement > > a DataSet. obviously, if the data is coming out of a database, > it will be > > entirely dependent on what db you're using and what your table structure > > is. > > > > think of it like this (i use struts, so this will be in struts > > terminology, > > but the idea applies for any MVC framework). > > > > in your action, you find out which type of data the user wants, say > > they're > > looking for red widgets. you instantiate a object that > implements DataSet. > > you can construct it in some way that it knows to search for > red widgets, > > for examples DataSet ds = new MyDataSet(ProductType.WIDGET, > > ProductVariant.RED); > > > > then you stick that object in the request scope [ > > request.setAttribute("ds", > > ds); ], and forward to your view. then in the view you have your > > displaytag: > > > > <display:table name="ds"> ... </display:table> > > > > in the TableTag class, it would tell the DataSet what the sort > and paging > > is. then it calls DataSet.getHtmlData(), and then at that point, the > > DataSet > > will go out to the database and fetch the data. > > > > > > so you'd have different DataSets for different tables, all they > would know > > how to do is fetch some data that they were told to fetch given > a sort and > > page. > > > > --alex > > ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ displaytag-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/displaytag-devel