News: CodeProject hosts DBGrid for JSP tag library
- Posted by: Ted Neward
- Posted on: July 28 2004 11:34 EDT
For more, read DBGrid for JSP at CodeProject.
- CodeProject hosts DBGrid for JSP tag library by Marina Prikaschikova on July 29 2004 12:09 EDT
- CodeProject hosts DBGrid for JSP tag library by Masoud kalali on July 29 2004 12:09 EDT
- the old days of Model 1 are back! :S by Fernando Racca on July 29 2004 12:32 EDT
- CodeProject hosts DBGrid for JSP tag library by Masoud kalali on July 29 2004 14:01 EDT
- compare the three... by Matthew Wilson on July 30 2004 08:58 EDT
- compare the three... by Konstantin Ignatyev on July 30 2004 10:08 EDT
- compare the three... by javier castanon on August 02 2004 12:50 EDT
- compare the three... by Nils Kilden-Pedersen on August 06 2004 12:55 EDT
See also Coldtags suite at http://www.servletsuite.com/jsp.htm
for ASP.NET similar controls
I love displaytag -- but it is very easy to hang yourself with it. Every developer in your team ends up putting large collections in session or sfsb for dipslaytag. Your session becomes bloated.
Valuelist is much much better !
Thanks for Mr Prasad Khandekar for his job.
I'm wondring why should TSS announce this , and did not talk about other project like dbforms ,butler , Valuelist ,... which done similar job.
maybe its important because its announced in an MS friendly site.
if you checked codeproject so take a look at:
http://valuelist.sourceforge.net/ which is completely implemented by considring j2ee core patterns.
Also worth looking at displaytag.sf.net, excellent table handling plus Matt Raible
has a demo of an editable grid on his site. There was talk on the mailing list of integrating the editable grid into the core taglib but I don't know if that work has been finished yet.
well, since DbForms was mentioned, i'd like to say a few words about it:
The aim of the project is to make database application development for the Web as easy as, for instance, MS Access for Windows. I think, this goal has been largely reached: DbForms supports editable forms, nested sub-forms, sorting, searching etc. all out of the box, just like MS Access & Co. Wherever a web based database app has to be crafted quickly, DbForms could be relevant.
Especially for the *backend* (i.e. DB maintainence, etc.), it is an effective rapid application development tool. Of course, it is not a "one fits all" solution and was never designed to be one. For instance, I would not create a highly flexible shopping site frontend using DbForms. There are other tools (e.g. plain JSP/JSF) to do that. However, I can recommend it to use it for crafting the backends, which mostly follow a simple, relational/table based scheme, which still make up a considerable amount of project costs.
The URL is: http://jdbforms.sourceforge.net/
BTW - Although i have started the project initially in 2001 (which is why this post can be regarded biased :-), the project is now largely maintained by others, who, as i think, do a great job in advancing and documenting the project.
This spaghetti code is absolutly impractical and violates the MVC principle from start to end. Scriptlets all across the code...
DisplayTags by Matt Raible are a much cleaaner solution http://displaytag.sf.net
After going through the DisplayTag which you have mentioned, Only diference I see is support for objects stored in page context and expression language, which I think can be easily built in this control.
Most of such library try to get data from resultsets and try to map them into another object collection and render the same. Some have even gone far and implemented their own sort logic and of-course not to mention that they also tend to store these collections in session. To me just because session allows you to do so does not mean that you should save everything in it.
Prasad P. Khandekar
Knowledge Exists, Man only discovers it.
Hello, After going through the DisplayTag which you have mentioned, Only diference I see is support for objects stored in page context and expression language, which I think can be easily built in this control. Most of such library try to get data from resultsets and try to map them into another object collection and render the same.The "only" difference is that it doesn't encourage you to use a Connection to pull objects from the databse.
That's a lot of code that MUST be done in the Controller. Never in the View.
DisplayTags by Matt RaibleDisplay Taglib is not by Matt Raible. He just happens to be a project admin who is also more famous due to his books and tutorials (which are not advanced, but still a good resource for newbies).
Most work of Display Taglib is definitely from Ed Hill (original author, seems to be inactive) and Fabrizio Giustina (who refactors the library and do most of the work nowadays).
I would say Display Taglib is by Fabrizio Giustina.
This tag library has some nice basic features, but for some more advanced features, take a look at dotJ.
you have done a good job but not better than exists ones
Its better you check
i think its more pattern based implementation than yours ,
also maybe better looking , more customizations.
Every one has his own test. Customization's yes I agree but as it comes with source, can be added as and when required.
Let me take the time to compare what I believe are the best two options and discussion of the topic: The DataGrid.
Both ValueList and DisplayTag are hosted on sourceforge. The DataGrid is hosted on a lesser know site for java developers, CodeProject.
Simplicity is a growing trend in the java space, a good book on this topic is Better, Faster, Lighter Java (ISBN: 0-596-00676-4). The author stresses simplicity over and over. This is one area where the ValueList and DisplayTag excel. Both implementations consume a List and display it. The DataGrid seems to be verbose in its use, and overly complex compred to the flexability it provides.
From one to ten, where ten is the simplest solution that meets the need:
To Java developers design and flexibility are very important. This is one area where there are lots of comparisons. Lets start with the DataGrid.
The DataGrid is lacking any indication of design, let alone good design. Lets say that you want to display a table (grid) of POJOs. The POJOs are coming from say, a call to a service you do not own. How are you going to display the List of POJOs? You cant the only thing you can display are the results of a SQL query. MVC, has anyone heard of this pattern? And the DataGrid has to be passed the java.sql.DataSource enough said there!
The ValueList is unique from the other three in that it has a consistent design and solution for retrieving and displaying data. The ValueList project focuses on providing a service and interfaces for retrieving paged data. The taglibs are jut part of the project. Using the ValueList you can either use a tag to retrieve the data from the service (pull pattern), or you can pick up the List from the pageContext (push pattern).
The DisplayTag also is built upon good design. There are a few flaws, such as the Decorator concept, but overall it is a flexible product.
From one to ten, where ten is a well designed flexable solution:
In conclusion, the DataGrid was model after a .net component. The typical limitation and design style of the Microsoft platform are seen in this component. The ValueList is focused on promoting consistency in both the retrieval and displaying of a List of POJOs. The DisplayTag provides a flexible solution to displaying Lists of POJOs.
Matthew, Thank you VerY much for postting your comparison!
Come on guys!
You are missing the point, I'm afraid. This kind of solutions are for small projects, or for some small parts of a big project. It let you do some things in a "quick and dirty" way, and depending on the circumstances, it would be OK. Why in the world I should 1) retrieve data, 2) iterate over it 3) create instances of objects for each row 4) add the items to a list, 5) iterate again over the list, just to show in a web page some records from a database or to do a very simple (and perhaps stupid) edition?
If scriptlets in the JSP are so bad, you can easily put them in another component, and then put the recordset in the request scope. If patterns are the only way to do things, I made a mistake: I'm finishing a two weeks little and disposable project with JSP 2.0/JSTL/DisplayTag. I should've used PHP instead. Or ASP.NET. :-(
I perfectly agree with you. The only reason which tempted me to develope this control is to avoid those extra passes. The applications which I developed so far have always interacted with databases and always have an requirement to display data in a grid fashion.
I am always surprised by the java developer's/designers this kind of attitude. Why they can not appriciate the object model of a resultset. I think it's a very generic obect model to access the data. The table in this case represents the blueprint and resultsets provide a generic way to access data represented by various such blueprints. It's a similar model one would come up with his/her own intrface definitions and associated implementations.
Prasad P. Khandekar
This is normal in Java to do over engineering. When 90% projects are developed using databases as backend then why we need to add extra complexity for 10% projects where you are not going to get DataRecord set.
All projects required different tools and we should not stop using any tool only because it is not developed using some patterns. As fas my understanding patterns are for reducing complexity not increasing it.
After a closer look and trying to customise some of the Value List samples and tutorials, I must fully admit, it is useless for everything than very small and very limited applications or parts of an application. Basically it even fails to retrieve a slightly longer list from an Oracle DB, while limited queries (e.g. grouped to more dense "statistic" kind of views) based on the same data set work fine. Its memory management and design seems to lack real world capability quite a lot and the continuous recreation of HSQL data in memory also kills every average (up to date release) Tomcat, even if you got at least 1GB of RAM. DisplayTags has some shortcommings, like the URL scheme mentioned here earlier. That unfortunately makes it also harder to use within MVC frameworks such as Spring, Struts, or similar ones. Other than that the lists of Pojos there can be rather large. And while only sorting each page (but at least it does not run out of memory ;-) the handling of pages is done correctly even for very long lists.
From one to ten, where ten is a well designed flexable solution: ValueList 9DisplayTag 8 DataGrid 2In conclusion, the DataGrid was model after a .net component. The typical limitation and design style of the Microsoft platform are seen in this component. The ValueList is focused on promoting consistency in both the retrieval and displaying of a List of POJOs. The DisplayTag provides a flexible solution to displaying Lists of POJOs.I wasn't aware of ValueList, but it seems interesting. The one thing that seems to be a problem is the utter lack of proper documentation and the HUGE list of dependencies.
Isn't there a simple tag library that will make every column sortable automatically and let me control the presentation with JSTL, without giving me a huge laundry list of dependencies?