Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using pagination in NetBeans  RSS feed

 
Andrey Alexandrov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, i am new to Java and now trying to work with a MS SQL database. I have this code (i'm using NetBeans with GlassFish) -


I need to do a pagination without external resources (like PrimeFaces), so i also find this working sample of pagination -







Question - what should i change in my code to be able to use method from sample program?
 
Chris Ernst
Ranch Hand
Posts: 37
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Andrey welcome to the Ranch :)

you have to import the other classes in your main class... here an example


Coffee is your sample class where you have some milk and sugar or other thinks...

and in the class where you want to use Coffee you initialize like the code sample and then you use



I hope this it is what you want to know :)

cheers
Chris
 
Andrey Alexandrov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this, Chris)
But i don' understand how it work in the sample. This method looking for some IDs... How can i find them in my table from database?
 
Chris Ernst
Ranch Hand
Posts: 37
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'am sorry :(

I'll take another look :)
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too complicated for me. I charge money for solutions like that.

Personally, I recommend using a pre-debugged solution like the pagers in PrimeFaces, RichFaces, Apache Tomahawk, or whatever. They're all open-source (or if not, at least most of them are), so it isn't like there's legal restrictions and keeping the code debugged and up-to-date becomes Someone Else's Problem.

Writing one's own binary custom tags is JSF is something I consider a solution of last resort. The internals of JSF can be quite mutable and in my opinion probably at least one more major architectural overhaul is going to be needed before things get stable enough to waste time coding one-off solutions that may break utterly when a new JSF version comes out.
 
Andrey Alexandrov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim, it's a good idea, but it was strictly forbidden for me to use them.
"You can't see their innards, so in case of any problems there you cant fix them"
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrey Alexandrov wrote:
"You can't see their innards, so in case of any problems there you cant fix them"


False.

These are open-source products. Anyone can pull a copy of the source, make any mods they need to, and even post them back to the product owner for potential inclusion in future releases. I can and have done that specifically on RichFaces. And in the case of the Pentaho Data Interchange product (Kettle), if you pull the production source code and look at some of the Excel input modules, you'll see my name in the comments, because I didn't like how non-intuitive the original implementation was, made some changes and had them accepted.

Not Invented Here is false economy. If you use an open-source product, you have an entire planet's resources available to support it. In many cases, you also can get paid support as well. Having both options is especially good, since some very expensive products I can name have pretty rotten (but expensive) support. Plus, in extremis, as I said, you can always yank down a copy of the source and fix it yourself.

And, I should point out that pageable tables are one of the most common UI features there are, so that particular function has had years to get the kinks out of both open and closed-source JSF products. You won't find too many bug reports on datatable paging anymore.

Doing it yourself can be a very expensive solution for an era when expensive solutions are not fashionable. And in the case of custom binary JSF controls, even more expensive than most, since, as I said, I don't think JSF's innards are all that frozen yet. I can say that the one custom binary tag I wrote (a Google Maps control back before the third-party packages had one) required some significant re-work when I moved from JSF 1 to JSF 2.

Murphy's Law says that the time that an NIH solution will break will be about the most inconvenient time possible. And once broken, there's no one else going to be able to help you. So for cases where there isn't a compelling reason - say a JSF control to operate a nuclear reactor using classified interfacing - it's not at all wise to do it yourself.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!