У нас вы можете посмотреть бесплатно 80 Mini Project Discussion | JSP Tutorial или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
80 Mini Project Discussion | JSP Tutorial #Mini Project Discussion: ========================= We can send only serializable java obejcts over the network. ResultSet object is not Serializable object, so we can not send that object over the network. To solve this problem there are two approaches Approach 1 : Use RowSet instead of ResultSet . All RowSet obejcts are serialiazable by default. Very few JDBC driver supports RowSet. Approach 2: Copy the records of ResultSet object to collection framework variable datasource and send that datasource over the network. All collection framework datastructure are serializable by default. Working with approach 2 is industry standard and recommended to use. 1) If you are looking to perform only read operations on collection framework datastructure then use non-synchronized data structure for better performance. Ex: ArrayList, HashMap etc. 2) If you are looking to perform simulataneous read and write operations on datastructure the prefere synchornized datastructure for threadsafety. Ex: Vector, HashTable etc... Fig : refer Resultset to arraylist We can not send each record of ResultSet to each element of ArrayList because each object of ResultSet contains multiple records /values , where each element of Arraylist allows to hold only onle obejct at a time. To solve the above problem keep each of ResultSet in user-definded java class obejct and add that obejct to each element of ArrayList. The user defined java class is called Value Object (VO) or Data Transfer Object (DTO) class. The obejcts added to the elements of collection framework datastructure should be take as serializable obejct in order to send the datastructure over the network. Ex: public class StudentBean implements java.io.Serializable{ //bean properties private int no; private String name; private String address; //write getXxx() and setXxx(-) methods public void setNo(int no){ this.no = no; } public int getNo(){ return no; } //write remaining getter and setter methods for bean properties ...... } Logic to write/copy the records of ResultSet obejct to Arraylist object. ArrayList al = new ArrayList(); ResultSet rs = statement.executeQuery("select sno, sname, sadd from student"); while(rs.next()){ //get the each records from ResultSet object rs. int no = rs.getInt(1); Stirng name = rs.getString(2); String add = rs.getString(3); //Store each record into Data Trasfer object / value object i.e StudentBean obj StudentBean sb = new StudentBean(); sb.setNo(no); sb.setName(name); sb.setAdd(add); //add Data Trasfer object / value class object to arraylist al.add(sb); } Fig: Refer Resultset to DTO to arraylist Implementation of Mini Project 1: ---------------------------------- This mini project 1 will be implemented based on MVC 2 architecture. M Model : Contains only business logic + Persistance logic (java class + java beans) V View : presentation logic (JSP program) C Controller : Contains integration logic (servlet program) Flow of execution: