CourseOutline Example & JavaBeans Lec - 36. Start with Example Displaying Course Outlines User will select either course “web design & development” or.

Slides:



Advertisements
Similar presentations
JSP -exercises- Alessandro Marchetto Fondazione Bruno Kessler-IRST, Centro per la Ricerca Scientifica e Tecnologica.
Advertisements

JSP and Servelets.
Apache Struts Technology
Chapter 81 JavaBeans JavaServer Pages By Xue Bai.
JBoss Seam: Contextual Components Jason Bechtel
DT228/3 Web Development Java Beans. Intro A major problem with JSP is tendency to mix java code with HTML  -  web designer write the HTML and programmer.
Structure of a web application1 Dr Jim Briggs. MVC Structure of a web application2.
ECE356 – Database Systems Lab 1 – Building a Web Project with NetBeans Tiuley Alguindigue Lab Instructor – University of Waterloo, E & CE Dept. Fall 2013.
Java Enterprise Edition Java Web Development Structure of a web project Introduction to Web Applications The first project Introduction to Java Web Development.
Struts 2.0 an Overview ( )
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
Chapter 5 - Writing a Problem Domain Class Definition1 Chapter 5 Writing a Problem Domain Class Definition.
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.
CSCI 6962: Server-side Design and Programming Support Classes and Shopping Carts.
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Java Servlets and Java Server Pages Carol Wolf Computer Science.
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
 Embeds Java code  In HTML tags  When used well  Simple way to generate dynamic web-pages  When misused (complex embedded Java)  Terribly messy.
JBoss Seam Presented by Andy Nguyen Truc Pham. What is JBoss Seam? Created by Gavin King Created by Gavin King A lightweight framework for Java EE 5.0.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
Mark Dixon 1 12 – Java Beans. Mark Dixon 2 Session Aims & Objectives Aims –To cover the use of Java Beans Objectives, by end of this week’s sessions,
Case Study + MVC Lec Error Pages By means of the page directive, a JSP can be given the responsibility of an Error page An Error JSP will be called.
16-Oct-15 JSP Implicit Objects. 2 JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer.
Composition - 1 J. Sant.. Agenda Define Composition Reuse and Composition. Composition in Java. Composition Exercise with simple containment.
J2EE Overview Web Programming CSCI J2EE multi-tier architecture Servlet: Java class loaded into Web server JSP page: enhanced HTML page that is.
CS320 Web and Internet Programming Java Beans and Expression Language (EL) Chengyu Sun California State University, Los Angeles.
3-Tier Web Application Architecture. Simple Log-in public String button1_action() { // TODO: Process the button click action. Return value is a navigation.
MVC Model 2 Architecture & AddressBook case study
JSP Tag Libraries Lec Last Lecture Example We incorporated JavaBeans in “Course Outline” Example But still have to write java code inside java.jsp.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA ‏ Visibility Control.
Defect, Problem and Progress Tracking System John Biddle.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
Presentation & Business Tier Design Patterns Pearce.
Chính phủ điện tử TS. Phạm Văn Tính Khoa CNTT, ĐH Nông Lâm TP.HCM
AP Computer Science A – Healdsburg High School 1 Unit 9 - Why Use Classes - Anatomy of a Class.
JSP BASICS AND ARCHITECTURE. Goals of JSP Simplify Creation of dynamic pages. Separate Dynamic and Static content.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
Enterprise JavaBeans Session Beans. Session beans are a type of Enterprise JavaBean component designed to implement business logic responsible for managing.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 43 JavaServer Page.
JavaServer Faces framework Craig McClanahan is presented that created Struts web framework and based on experience gathered designed JavaServer.
Introduction to Java John Lewis. Course Overview Introduction Object Orientated Programming Java Structure and Syntax Using the Java Platform Advanced.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Chapter 6 Chapter 6 Server Side Programming (JSP) Part 1 1 (IS 203) WebProgramming (IS 203) Web Programming.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Chapter 14 Using JavaBeans Components in JSP Documents.
Dale Roberts Object Oriented Programming using Java - Getters and Setters Dale Roberts, Lecturer Computer Science, IUPUI
Apache Struts Technology A MVC Framework for Java Web Applications.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
CS 562 Advanced Java and Internet Application Computer Warehouse Web Application By Team Alpha :-  Puja Mehta (102163)  Mona Nagpure (102147)
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Introduction to Server-Side Web JavaBeans; basic concepts and syntax.
Introduction to java (class and object). Programming languages: –Easier to understand than CPU instructions –Needs to be translated for the CPU to understand.
OOP: Encapsulation &Abstraction
Structure of a web application
Scripted Page Web App Development (Java Server Pages)
Recitation #3 Comp Semion Piskarev.
JavaBeans and JSP CS-422.
Introduction to Java Bean
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
Introduction to Java Bean
An Introduction to Java – Part II
CS320 Web and Internet Programming Java Beans
The Object-Oriented Thought Process Chapter 04
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
CS3220 Web and Internet Programming Expression Language (EL)
Object-Oriented Programming
CS3220 Web and Internet Programming Expression Language (EL)
Object-Oriented Design AND CLASS PROPERTIES
Encapsulation.
Presentation transcript:

CourseOutline Example & JavaBeans Lec - 36

Start with Example Displaying Course Outlines User will select either course “web design & development” or “java”. On submitting request, course outline would be displayed of the selected course from database

Program Flow index.jsp controller.jsp web.jsp java.jsp If page = = web If page = = java

Issues with Last Example Too much cluttered code in JSP –Difficult to understand A single page is doing everything – bad approach –Displaying contents (Presentation logic) –Connecting with database (DB connectivity logic) –Results Processing (Business Logic) Solution: –Use JavaBeans

JavaBeans

What are JavaBeans? Java class that can be easily reused and composed together in an application Any java class that follows certain design conventions can be a JavaBeans component

JavaBeans Design Conventions A bean class must have a zero argument constructor A bean class should not have any public instance variables (fields) Private values should be accessed through setters/getters –For boolean data types, use boolean isXXX( ) & setXXX(boolean) A bean class must be serializable

A Sample JavaBean public class MyBean implements Serializable { private String name; // zero argument constructor public MyBean( ){ name = “”; } // standard setter public void setName(String n) { name = n; }

A Sample JavaBean cont. // standard getter public String getName( ) { return name; } // any other method public void print( ) { System.out.println(“Name is: ” + name); } } // end Bean class

Incorporating Bean in Last Example Create a CourseOutlineBean –Has following attributes sessionNo topic assignment Create a CourseDAO (bean) –Encapsualte database connectivity logic web.jsp & java.jsp will use these beans

Example Code Incorporating JavaBeans in CourseOutline Example