Pagination struts2

johnjjj Messages postés 120 Date d'inscription dimanche 4 avril 2010 Statut Membre Dernière intervention 24 septembre 2012 - 23 déc. 2010 à 13:35
johnjjj Messages postés 120 Date d'inscription dimanche 4 avril 2010 Statut Membre Dernière intervention 24 septembre 2012 - 23 déc. 2010 à 14:11
Bonjour j’utilise struts2 et hibernat je souhaite faire pagination
1 Page Action.java qui contien list

 
package p;
public class Actionn extends ActionSupport{
Configuration configuration =  new Configuration().configure();
        SessionFactory factory = configuration.buildSessionFactory();
        Session session = factory.openSession();
        Transaction tx = null;
        Customer c=new Customer();
 List<Customer> customerList = new ArrayList<Customer>();
/////////////////////////afficher
public String Affi(){
        try {
tx = session.getTransaction();
            tx.begin();
         tx = session.beginTransaction();
  customerList= session.createQuery("from Customer").list();
 tx.commit();
       } finally {      session.close();
        }return "SUCCESS";}}



2 Page jsp contien

<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<jsp:directive.page import="p.*, java.util.*" />
<%@ page import="java.util.*"%>
<%@ taglib prefix="s" uri="/struts-tags" %>


    
        Hello World!

         Exemple : Pagination 
        <display:table name ="customerList"  class="p.Action"   pagesize="4">
    <display:column property="customerId" title="customerId°" />
    <display:column property="name" title="name"  />
    <display:column property="address" title="address" />
  </display:table>
    
</html>



Cette page affiche le tableau
Mais lorsque je clique sur next ou last page il affiche exception

HTTP Status 500 - 
________________________________________
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception 
org.apache.jasper.JasperException: java.lang.IndexOutOfBoundsException: fromIndex = -4
root cause 
java.lang.IndexOutOfBoundsException: fromIndex = -4
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.0.1 logs.
________________________________________
GlassFish Server Open Source Edition 3.0.1



je sais pas pourquoi
merci

1 réponse

johnjjj Messages postés 120 Date d'inscription dimanche 4 avril 2010 Statut Membre Dernière intervention 24 septembre 2012
23 déc. 2010 à 14:11
bonjour
je problème est resoulu j'ai mis ma list dans sessionScope
merci
0
Rejoignez-nous