Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using JavaBeans Components in JSP Documents. Contents 1. Why using beans? 2. What are beans? 3. Using Beans: Basic Tasks 4. Sharing Beans 5. Practice.

Similar presentations


Presentation on theme: "Using JavaBeans Components in JSP Documents. Contents 1. Why using beans? 2. What are beans? 3. Using Beans: Basic Tasks 4. Sharing Beans 5. Practice."— Presentation transcript:

1 Using JavaBeans Components in JSP Documents

2 Contents 1. Why using beans? 2. What are beans? 3. Using Beans: Basic Tasks 4. Sharing Beans 5. Practice exercise

3 1. Why Use Beans? - Separate class are easier to write, compile, test, debug and reuse. - No Java syntax - Simpler object sharing - Convenient correspondence between request parameters and object properties. - (Part II, chapter 14)

4 2. What Are Beans? A bean class must have a zero- argument (default) constructor A bean class should have no public instance variables (fields) Persistent values should be accessed through methods calledget Xxx and setXxx

5 3. Using Beans: Basic Tasks jsp:useBean jsp:getProperty jsp:setProperty

6

7 Accessing Bean Properties: jsp:getProperty

8 4. Sharing Beans

9 5. Practice Exercise Develop a WebApp to manage product information. The WebApp allow use add and update a product. Each product has name, description, price, producer name.

10 Create JSP to add new Product using Product bean productType.insert(conn)


Download ppt "Using JavaBeans Components in JSP Documents. Contents 1. Why using beans? 2. What are beans? 3. Using Beans: Basic Tasks 4. Sharing Beans 5. Practice."

Similar presentations


Ads by Google