Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I divide the result of a query in several JSP files?

 
Samuel Castillo Romero
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web application and I'm using Hibernate + Spring + Struts 2.

I have a transporters class where I have a lot of information about them. I have about 400 transporters and when I show a list of transporters I don't know how divide the list in several JSP files.

I would like to get a list of 10 transporters and show another 10 tranporters if I click a next buttom and so on...

Is possible do that? Is very heavy for my application to show all the transporters (about 400 transporters)

I have been thinking about it and I have no idea how can I do it.
Any advice?

Thanks and sorry for my english!

-Samuel-
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The term you're looking for is "pagination" or "paging": http://www.coderanch.com/how-to/java/PaginationOrPaging
 
Samuel Castillo Romero
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:The term you're looking for is "pagination" or "paging": http://www.coderanch.com/how-to/java/PaginationOrPaging


hehehe I didn't know the name of the term!!

I'm going to read about "pagination" and try to use it with Struts 2

Thanks for all buddy!!

-Samuel-
 
Samuel Castillo Romero
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again!

I'm trying to use Display tag but I can't.

I have a JSP file and if I try to put this "code" in my file I get an unhandled exception.

This is the code that I put in my JSP file (I know, is a stupid code, but I'm only want to know if Display tag works or not)



and this is the error:



Any advice?

Thanks!
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DisplayTag consists of numerous jar files; did you copy them all to your web app's WEB-INF/lib directory? Particularly one called commons-lang-XYZ.jar? That's the missing one "java.lang.NoClassDefFoundError: org/apache/commons/lang/UnhandledException" is complaining about.
 
Samuel Castillo Romero
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:DisplayTag consists of numerous jar files; did you copy them all to your web app's WEB-INF/lib directory? Particularly one called commons-lang-XYZ.jar? That's the missing one "java.lang.NoClassDefFoundError: org/apache/commons/lang/UnhandledException" is complaining about.


That was!!

Thanks for all!!

I have added this jar files which I didn't have in my application:

commons-beanutils
commons-lang
commons-collections


-Samuel
 
Samuel Castillo Romero
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again!

I have resolved the problem with display tag and now it works nice but I would like to change somethings and I don't know how.

The result of my data table is something like this:




***I would like to change the languaje of this sentence:
"13 items found, displaying all items"

***I would like to show borders in my data table.

And finally...

***I would like to change the id (1,2,3,4,5,6,7...) to the sentence "Ver más". I would like that always show "Ver mas" althought, really the value of this field is the id. My code is:


This is the column but if I use property = "id" then I can't use value = "Ver más"

Thanks in advance!!
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check the DisplayTag web site? It has tutorials on just about all aspects that are customizable.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!