开发者

How display tag renders the data in JavaEE?

From the time I started working with JavaEE, I've made ​​my way paginating a list in the .jsp, b开发者_如何学编程ut I have seen many of Java developers are using display tag library, why, I don't know, as I know display tag library gets the whole list in the page, and only then will process it, and if you still have thousands of entries in the database? what about that? and finally what are the cons and pros of this library?


The tag works with the list of result you give it. It can be results for a page or the entire list which it splits in multiple pages. It is not called a display tag by chance, it actually displays the data you provide it with.

If you have thousands of entries in the database its your job to manage them, not the tag's. The display tag is just a tool. You can use it or look for another tool.

And finally what are the cons and pros of this library?

The display tag (any server tag actually) is used to limit the amount of boiler plate code you have to write for yourself in order to get the job done.

Write the code your way, then write the code using the display tag. Which one is shorter? The display tag’s will be.

If you write a paginating table once in a full moon you don’t really see the benefit, but if you write lots of tables then at some point the time will start to add up. The library use means less boilerplate code to write and it doesn’t add up as much (i.e. it’s faster to write).

One other important thing the tag introduces is consistency. If all the developers use the display tag then all will have an easy time working on each other’s code. Trust me, I have worked with both the display tag and with no display tag. It was a jungle without it. Every developer had its style of creating the pagination, managing interactions at the server, scriptlets all around... it was crazy!

I’m not saying it’s the Holly Grail of paginating tables (for example I don’t use it in one of my pet projects although I have lots of tables to display. But I do have my own custom tag especially designed for my specific purposes which brings me the speed and consistency).

You are not obliged to use the display tag but it is a pretty good library, lots of configurations too. So try reading it’s documentation before making a decision.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜