Привет все) А никто не пробовал используя displaytag сортировку замутить? В jsp делаю так
| Код | <display:table name="lecturerCollection"> <display:column href="getlecturerinfo.do" paramId="urlParamBean" paramProperty="id" property="name" /> <display:column sortable="true" property="degree" /> </display:table>
|
т.е когда на название столбца нажиаю, он по идеи содержание должен отсортировать, но в место отсортированной таблици появляется "Nothing found to display." Коллекцию я свою храню в ArrayList и получаю следующим образом:
| Код | ArrayList lecturersList = new ArrayList(); Connection conn = dataSource.getConnection(); LecturerDAO lDAO=DAOFactory.createLecturerDAO(conn); lecturersList=lDAO.getLecturers(); req.setAttribute("lecturerCollection",lecturersList);
|
вот классы и интерфес которые я юзаю
| Код | public interface LecturerDAO{ public ArrayList getLecturers() throws SQLException; public ArrayList getLecturerById(int id); }
|
| Код | public class DAOFactory { /** Creates a new instance of DAOFactory */ public DAOFactory() { } public static LecturerDAO createLecturerDAO(Connection connection){ return new DerbyLecturerDAO(connection); } }
|
| Код | public class DerbyLecturerDAO implements LecturerDAO { private Connection connection; private Statement stm; private Vector vctDL=new Vector(); /** Creates a new instance of DerbyUserDAO */ public DerbyLecturerDAO(Connection connection) { this.connection = connection; }
public ArrayList getLecturers() throws SQLException{ ArrayList lecturersList = new ArrayList(); try { stm=connection.createStatement(); ResultSet rsm=stm.executeQuery("SELECT LECT_ID,LECT_SNAME,LECT_NAME,LECT_FNAME,LECT_DEGREE FROM LECTURER"); while(rsm.next()){ DataLecturer lEn=new DataLecturer(rsm.getInt(1),rsm.getString(2),rsm.getString(3),rsm.getString(4),rsm.getString(5)); LecturerEnumBean buf=new LecturerEnumBean(); buf.setId(lEn.getIdLecturer()); buf.setName(lEn.concNS(lEn.getSnameLecturer(),lEn.getFnameLecturer(),lEn.getNameLecturer())); buf.setDegree(lEn.getDegreeLecturer()); lecturersList.add(buf); vctDL.add(lEn); }; rsm.close(); } catch (SQLException ex) { throw ex; }
return lecturersList; }
public ArrayList getLecturerById(int id) { return null; }
}
|
| Код | public class LecturerEnumBean { private int id=0; private String name=null; private String degree=null; public int getId(){ return this.id; } public void setId(int id){ this.id=id; } public String getName(){ return this.name; } public String getDegree(){ return this.degree; } public void setName(String name){ this.name=name; } public void setDegree(String degree){ this.degree=degree; } }
|
Может кто сталкивался с подобной проблемой и подскажет в чем причина может быть, почему коллекция пропадает? |