• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to use IBatis to paging in jsp?

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone:
I'm a new comer in IBatis.If I query the database using the method "executeQueryForList" how to display the record in jsp (for example 10 record)? How to process the parameter?
If someone used it please help me.
Thks
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Iam jasmine,
Well use statement.getResultSet(); which will return the refernce of ResultSet interface and the use next() method of resultset and then put in the loop as resulset will retrun the object. then use resultset.getString() method.
so code would be
ResutlSet rs=statement.getResultSet();
while(rs.next())
{
String s1=rs.getString(int column index);
out.println(s1);
}
but dont forget to close the resultset and put try and catch .
So I hope this will solve ur problem.

Thanks
Jasbir
 
lyo Yashnoo
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you
But I think the method "executeQueryforPaginatedList" will be better.Because it has associated method "nextPage(), previousPage(), gotoPage(),isMiddlePage(), isLastPage(), isNextPageAvailable(),".
What I want to know is how to display the page number according to the resultset.For example,If I want to display this in jsp:
"<<back 1 2 3 4 last>>>"
How to display the number "1,2,3,4"?
I means that if I query 10 record per time how to display it in jsp?
:roll:
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use the pager taglib for this. It does exactly what you want to achieve (automatically!!)...
just a suggestion
 
lyo Yashnoo
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I had use that pager taglib to paging and it is easy to use.But I find that (some O/R Mapping) either Hibernate or (SQL-Mapping)IBatis support some companient method for paging.For example ,Hibernate can get any count record per time.IBatis also can do this. So I can use them paging if I know the only one of them.
I am very want to master the one paging method of them.
Someone can help me?
Thanks :roll:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic