CISH-6510 Web Application Design and Development. JSP and Beans. Overview

Size: px
Start display at page:

Download "CISH-6510 Web Application Design and Development. JSP and Beans. Overview"

Transcription

1 CISH-6510 Web Application Design and Development JSP and Beans Overview WeatherBean Advantages to Using Beans with JSPs Using Beans Bean Properties Weather Example Sharing Beans Timer Example 2 1

2 WeatherBean package heidic; public class WeatherBean {// Define private properties private String zipcode; private int currenttemp; private int high; private int low; private String forecast; 3 WeatherBean public WeatherBean() { zipcode = "00000"; currenttemp = 0; high = 0; low = 0; forecast = "Not available."; } 4 2

3 WeatherBean public String getzipcode() { return zipcode; } public void setzipcode( String zip) { zipcode = zip; } public int getcurrenttemp() { return currenttemp; } 5 WeatherBean public int gethigh() { return high; } public int getlow() { return low; } public String getforecast() { return forecast; } 6 3

4 WeatherBean public void update(string z) { zipcode = z; if (zipcode.equals("06120")) { currenttemp = 70; high = 72; low = 50; forecast = "Cloudy"; } 7 WeatherBean else if(zipcode.equals("11111")) { currenttemp = 30; high = 32; low = 10; forecast = "Snowy"; }else if(zipcode.equals("22222")) { currenttemp = 90; high = 92; low = 80; forecast = "Sunny"; } 8 4

5 WeatherBean else { currenttemp = 70; high = 72; low = 50; forecast = "Cloudy"; } } } 9 Advantages to Beans and JSPs 1. Java syntax is hidden. Page authors can manipulate Java using XML syntax only Stronger separation between content and presentation Useful when developing with separate teams of HTML and Java developers 2. Simpler object sharing. Easy to share beans across pages in application 10 5

6 Advantages to Beans and JSPs 3. Convenient mapping between request parameters and object properties. Bean constructs simplify the loading of beans 11 Using Beans With JSPs Beans are placed into a JSP page using three Bean tags: <jsp:usebean> <jsp:setproperty> > JSP also supports custom tags to provide more complex functionality. More in another segment 12 6

7 Using Beans With JSPs Beans are loaded into a JSP page using the <jsp:usebean> action: <jsp:usebean id= beanname class= package.class /> <jsp:usebean id= wbean class= heidic.weatherbean /> (Usually) tells server to create instance of bean and bind to id name. Variable is in _jspservice method of servlet 13 Using Beans With JSPs usebean tag has attributes: 1. id - specifies unique name for bean. Required Must be unique to the page in which it is defined Is case sensitive First character must be a letter Only letters, numbers, and underscore allowed no spaces 14 7

8 Using Beans With JSPs 2. class - specifies class name of JavaBean. Required Usually includes package designation 15 Using Beans With JSPs 3. type - allows you to refer to the bean using a base class of the bean or an interface that the bean implements. Throws ClassCastException if actual class is not compatible with type Not highly used <jsp:usebean id= mythread class= MyClass type= Runnable /> 16 8

9 Using Beans With JSPs 4. beanname - used like class attribute to refer to a bean. Can refer either to class or to file containing serialized bean object 5. scope - controls a bean s accessibility and life span. Valid values: page, request, session, and application 17 Bean Properties Once you have a bean, you can access its properties using the > action: name= beanname property= propname /> name= wbean property= zipcode /> 18 9

10 Bean Properties beanname is name of bean. property must match property name defined in bean. Case sensitive Must have previously created the bean via <jsp:usebean> 19 Bean Properties <jsp:usebean id= style class= beans.mystyle /> <html> <body bgcolor= name= style property= color /> > 20 10

11 Bean Properties <center> <img src= name= style property= logo /> > </center> </body> </html> 21 Bean Properties <html> <body bgcolor= red > <center> <img src= logo.gif > </center> </body> </html> 22 11

12 Bean Properties Note that we can use our bean variable in a JSP expression. Provides us two ways of retrieving data When would we use each approach? name= book property= title / > <%= book.gettitle() %> 23 Bean Properties To modify a bean s s properties use: <jsp:setproperty name= beanname property= beanprop value= newvalue / > <jsp:setproperty name= wbean property= high value= 90 / > 24 12

13 Bean Properties Developer must have provided appropriate set method for property. Could also use: <% wbean.sethigh(90); %> Bean action tags are evaluated from top to bottom of page. 25 Bean Properties Property values can be initialized when creating a bean: <jsp:usebean id = wbean class= heidic.weatherbean > <jsp:setproperty name= weatherbean property= zipcode value= /> </jsp:usebean> 26 13

14 Bean Properties The value and name attributes of setproperty may hold request-time time expressions. Use mix of single and double quotes <jsp:setproperty name= wbean property= zipcode value= <%= request. getparameter( zip ) %> /> 27 Bean Properties The param attribute may be used to directly associate a name to a form input parameter. Used in place of the value parameter Parameter value automatically used as value of property Simple type conversions performed automatically param must exactly match input name 28 14

15 Bean Properties <jsp:setproperty name= wbean property= currenttemp param= currenttemp /> Can be simplified if form element name and bean property match exactly: <jsp:setproperty name= wbean param= currenttemp /> 29 Bean Properties Automatic conversion supported for: boolean,, Boolean, byte, Byte, char, Character, double, Double, int,, Integer, float, Float, long, Long Associate all properties with identically named input parameters: Supply * for property parameter. <jsp:setproperty name= entry param= * /> 30 15

16 Bean Properties Cautions 1. System does not supply null for missing input parameters. Best to provide default value and then attempt to set from parameter: <jsp:setproperty name= wbean property= currenttemp value= 0 /> <jsp:setproperty name= Bean param= currenttemp /> 31 Bean Properties Cautions 2. Automatic type conversion does not guard against illegal values as effectively as manual type conversion. 3. Property names and input parameters are case sensitive

17 Weather Example Look at Weather JSP example at: webtech/examples.html 33 Weather Example weatherform.html <html> <head> <title> Heidi's Simple Page to Test Beans and JSPs</title> </head> <body bgcolor="white"> <h1> Testing Beans and JSPs </h1> When user enters their

18 Weather Example weatherform.html <ul> <li> (Hartford) </li> <li> (Nome) </li> <li> (Hawaii) </li> </ul> <form action=" facweb1.rh.edu/users/heidic/ jsp/weather.jsp"> 35 Weather Example weatherform.html Enter a new zipcode: <input type="text" name="zip"> <input type="submit" value="submit your entry."> <input type="reset" value="clear your entry."> </form> </body> </html> 36 18

19 Weather Example weather.jsp <html> <head> <title> Heidi's Simple Beans Test </title> </head> <body bgcolor="white"> <center> <h1> Heidi's Test Page for Simple Beans </h1> </center> 37 Weather Example weather.jsp <h2> This page tests using a simple Weather JavaBean with a JSP. </h2> <jsp:usebean id="weatherbean" scope="page" class="heidic.weatherbean" /> 38 19

20 Weather Example weather.jsp <ul> <li> Initial value of zipcode: name="weatherbean" property="zipcode" /> <li> Initial value of current temperature: name="weatherbean" property="currenttemp" /> 39 Weather Example weather.jsp <li> High temperature: name="weatherbean" property="high" /> <li> Low temperature: name="weatherbean" property="low" /> 40 20

21 Weather Example weather.jsp <li> Forecast: name="weatherbean" property="forecast" /> </ul> <% weatherbean.update( request.getparameter("zip"));%> <h3>.. after updating the weather: 41 Weather Example weather.jsp <ul> <li> New value of zipcode: name="weatherbean" property="zipcode" /> <li> Current temperature: name="weatherbean" property="currenttemp" /> 42 21

22 Weather Example weather.jsp <li> High temperature: name="weatherbean" property="high" /> <li> Low temperature: name="weatherbean" property="low" /> 43 Weather Example weather.jsp <li> Forecast: name="weatherbean" property="forecast" /> </ul> </body> </html> 44 22

23 Sharing Beans Up to this point, we ve treated beans as local variables. Every time page is requested, new instance of bean is created and used The scope attribute controls bean s accessibility and life span. Determines which pages or parts of a Web application can access the bean Determines how long a bean exists scope has four possible values: 45 Sharing Beans page Scope 1. page - default value. Least accessible and shortest lived. New instance of bean is created each time page is requested. Beans not available to included or forwarded pages. Good when bean does not need to persist between requests. Good when bean does not need to be shared

24 Sharing Beans page Scope Bean object is placed in PageContext object for duration of current request. Beans can be retrieved by calling getattribute on pagecontext within servlet. <jsp:usebean id="weatherbean" scope="page" class="heidic.weatherbean" /> 47 Sharing Beans request Scope 2. request Accessibility extended to included and forwarded pages Bean put on HttpServletRequest object for duration of request. Also being bound to local variable Access by servlet is via setattribute on HttpServletRequest Allows servlet to create a bean and pass it to JSP page

25 Sharing Beans session Scope 3. session Bean is placed in user s session object (HttpSession( HttpSession). Page must be participating in sessions If not, causes error at translation time Access by servlet via session.getattribute method. Bean is available to any other JSP or servlet on server. <jsp:usebean> finds existing bean that matches id 49 Sharing Beans session Scope JSP container determines length of time a session bean exists. Typically a few hours Session beans useful for: Collecting information through a user s visit to site Caching information frequently needed at page level Passing information from page to page with low processing time 50 25

26 Sharing Beans application Scope 4. application Broadest lifecycle and availability. Stores information useful across entire application. Beans are associated with a given JSP application on server. Stored in ServletContext object. Retrieved by servlet via application.getattribute method Exist for life of JSP container. i.e., until server shuts down 51 Sharing Beans application Scope Bean shared by all application users. Must not depend on configuration of any page Changing a property will instantly affect all JSP pages which reference the bean Make sure that bean is placed into application scope before any dependent beans Application bean provides simple mechanism for multiple servlets and JSPs to access the same object

27 Timer Example Look at Timer JSP example at: webtech/examples.html 53 Timer Example TimerBean.java package heidic; public class TimerBean { private long starttime; public TimerBean() {starttime = System.currentTimeMillis(); } 54 27

28 Timer Example TimerBean.java public long getelapsedmillis() {long now = System.currentTimeMillis(); return now - starttime; } public long getelapsedseconds() { return (long)this. getelapsedmillis()/1000; } 55 Timer Example TimerBean.java public long getelapsedminutes() {return (long)this. getelapsedmillis()/60000; } public void reset() {starttime = System.currentTimeMillis(); } 56 28

29 Timer Example TimerBean.java public long getstarttime() { return starttime; } public void setstarttime(long time) {if (time < 0) reset(); else starttime = time; } } //End of class 57 Timer Example starttimer.jsp <html> <head> <title> Heidi's Sharing Beans Test </title> </head> <body bgcolor="white"> <center> <h1> Heidi's Test for Sharing Beans with JSP </h1> </center> 58 29

30 Timer Example starttimer.jsp <h2>this page tests starting a Timer bean from a JSP.</h2> <jsp:usebean id="timerbean" scope="session" class="heidic.timerbean" > <jsp:setproperty name="timerbean" property="starttime" value="-1" /> </jsp:usebean> 59 Timer Example starttimer.jsp Elapsed time (minutes): name="timerbean" property="elapsedminutes" /> Elapsed time (seconds): name="timerbean" property="elapsedseconds" /> </body> </html> 60 30

31 Timer Example usetimer.jsp <html> <head> <title> Heidi's Sharing Beans Test </title> </head> <body bgcolor="white"> <center> <h1> Heidi's Test for Sharing Beans with JSP </h1> </center> 61 Timer Example usetimer.jsp <h2>page tests sharing existing Timer bean from a JSP.</h2> <jsp:usebean id="timerbean" scope="session class="heidic.timerbean" /> Current elapsed seconds: name="timerbean" property="elapsedseconds" /> 62 31

32 Timer Example usetimer.jsp Elapsed time (minutes): name="timerbean" property="elapsedminutes" /> </body> </html> 63 Workshop 1 JSP and Beans Create an JSP which loads information into a JavaBean and redisplays the information. 1. Create a JSP that prompts the user for their name and address. 2. Within the JSP, create a JavaBean to hold the name and address. 3. Redisplay the name and address information from the JavaBean later in the JSP

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM Advanced Internet Technology Lab. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 5049 Advanced Internet Technology Lab Lab # 10 JAVABEANS IN JSP El-masry May, 2014 Objectives Understanding JavaBeans.

More information

Using JavaBeans with JSP

Using JavaBeans with JSP Using JavaBeans with JSP Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall, http://, book Sun Microsystems

More information

Java E-Commerce Martin Cooke,

Java E-Commerce Martin Cooke, Java E-Commerce Martin Cooke, 2002 1 Java technologies for presentation: JSP Today s lecture in the presentation tier Java Server Pages Tomcat examples Presentation How the web tier interacts with the

More information

Introduction to Java Server Pages. Enabling Technologies - Plug-ins Scripted Pages

Introduction to Java Server Pages. Enabling Technologies - Plug-ins Scripted Pages Introduction to Java Server Pages Jeff Offutt & Ye Wu http://www.ise.gmu.edu/~offutt/ SWE 432 Design and Implementation of Software for the Web From servlets lecture. Enabling Technologies - Plug-ins Scripted

More information

More JSP. Advanced Topics in Java. Khalid Azim Mughal Version date: ATIJ More JSP 1/42

More JSP. Advanced Topics in Java. Khalid Azim Mughal   Version date: ATIJ More JSP 1/42 More JSP Advanced Topics in Java Khalid Azim Mughal khalid@ii.uib.no http://www.ii.uib.no/~khalid/atij/ Version date: 2006-09-04 ATIJ More JSP 1/42 Overview Including Resources in JSP Pages using the jsp:include

More information

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1

CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, JSPs 1 CSc31800: Internet Programming, CS-CCNY, Spring 2004 Jinzhong Niu May 9, 2004 JSPs 1 As we know, servlets, replacing the traditional CGI technology, can do computation and generate dynamic contents during

More information

A JavaBean is a class file that stores Java code for a JSP

A JavaBean is a class file that stores Java code for a JSP CREATE A JAVABEAN A JavaBean is a class file that stores Java code for a JSP page. Although you can use a scriptlet to place Java code directly into a JSP page, it is considered better programming practice

More information

Scope and State Handling in JSP

Scope and State Handling in JSP Scope and State Handling in JSP CS 4640 Programming Languages for Web Applications [Based in part on SWE432 and SWE632 materials by Jeff Offutt] [Robert W. Sebesta, Programming the World Wide Web] 1 Session

More information

Integrating Servlets and JavaServer Pages Lecture 13

Integrating Servlets and JavaServer Pages Lecture 13 Integrating Servlets and JavaServer Pages Lecture 13 Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall,

More information

JavaServer Pages (JSP)

JavaServer Pages (JSP) JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult

More information

Java Server Page (JSP)

Java Server Page (JSP) Java Server Page (JSP) CS 4640 Programming Languages for Web Applications [Based in part on SWE432 and SWE632 materials by Jeff Offutt] [Robert W. Sebesta, Programming the World Wide Web] 1 Web Applications

More information

JSP - ACTIONS. There is only one syntax for the Action element, as it conforms to the XML standard:

JSP - ACTIONS. There is only one syntax for the Action element, as it conforms to the XML standard: http://www.tutorialspoint.com/jsp/jsp_actions.htm JSP - ACTIONS Copyright tutorialspoint.com JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically

More information

COMP201 Java Programming

COMP201 Java Programming COMP201 Java Programming Part III: Advanced Features Topic 16: JavaServer Pages (JSP) Servlets and JavaServer Pages (JSP) 1.0: A Tutorial http://www.apl.jhu.edu/~hall/java/servlet-tutorial/servlet-tutorial-intro.html

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2017 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2465 1 Review:

More information

Fast Track to Java EE 5 with Servlets, JSP & JDBC

Fast Track to Java EE 5 with Servlets, JSP & JDBC Duration: 5 days Description Java Enterprise Edition (Java EE 5) is a powerful platform for building web applications. The Java EE platform offers all the advantages of developing in Java plus a comprehensive

More information

JSP - SYNTAX. Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP:

JSP - SYNTAX. Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP: http://www.tutorialspoint.com/jsp/jsp_syntax.htm JSP - SYNTAX Copyright tutorialspoint.com This tutorial will give basic idea on simple syntax ie. elements involved with JSP development: The Scriptlet:

More information

Java Server Pages. JSP Part II

Java Server Pages. JSP Part II Java Server Pages JSP Part II Agenda Actions Beans JSP & JDBC MVC 2 Components Scripting Elements Directives Implicit Objects Actions 3 Actions Actions are XML-syntax tags used to control the servlet engine

More information

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

This course is intended for Java programmers who wish to write programs using many of the advanced Java features. COURSE DESCRIPTION: Advanced Java is a comprehensive study of many advanced Java topics. These include assertions, collection classes, searching and sorting, regular expressions, logging, bit manipulation,

More information

112-WL. Introduction to JSP with WebLogic

112-WL. Introduction to JSP with WebLogic Version 10.3.0 This two-day module introduces JavaServer Pages, or JSP, which is the standard means of authoring dynamic content for Web applications under the Java Enterprise platform. The module begins

More information

CE212 Web Application Programming Part 3

CE212 Web Application Programming Part 3 CE212 Web Application Programming Part 3 30/01/2018 CE212 Part 4 1 Servlets 1 A servlet is a Java program running in a server engine containing methods that respond to requests from browsers by generating

More information

1. Introduction. 2. Life Cycle Why JSP is preferred over Servlets? 2.1. Translation. Java Server Pages (JSP) THETOPPERSWAY.

1. Introduction. 2. Life Cycle Why JSP is preferred over Servlets? 2.1. Translation. Java Server Pages (JSP) THETOPPERSWAY. 1. Introduction Java Server Pages (JSP) THETOPPERSWAY.COM Java Server Pages (JSP) is used for creating dynamic web pages. Java code can be inserted in HTML pages by using JSP tags. The tags are used for

More information

JavaServer Pages. What is JavaServer Pages?

JavaServer Pages. What is JavaServer Pages? JavaServer Pages SWE 642, Fall 2008 Nick Duan What is JavaServer Pages? JSP is a server-side scripting language in Java for constructing dynamic web pages based on Java Servlet, specifically it contains

More information

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>

A.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype=text/html; charset=windows-31j import=java.util.calendar %> A JSP A.1 JSP Servlet Java HTML JSP HTML Java ( HTML JSP ) JSP Servlet Servlet HTML JSP MyDate.jsp

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:

More information

112. Introduction to JSP

112. Introduction to JSP 112. Introduction to JSP Version 2.0.2 This two-day module introduces JavaServer Pages, or JSP, which is the standard means of authoring dynamic content for Web applications under the Java Enterprise platform.

More information

01KPS BF Progettazione di applicazioni web

01KPS BF Progettazione di applicazioni web 01KPS BF Progettazione di applicazioni web Introduction to Java Server Pages Fulvio Corno, Alessio Bosca Dipartimento di Automatica e Informatica Politecnico di Torino PAW - JSP intro 1 Introduction to

More information

JSP Scripting Elements

JSP Scripting Elements JSP Scripting Elements Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 1 Slides Marty Hall, http://, book Sun Microsystems

More information

Using JavaBeans Components in JSP Documents

Using JavaBeans Components in JSP Documents 2003-2004 Marty Hall Using JavaBeans Components in JSP Documents 2 JSP and Servlet Training Courses: http://courses.coreservlets.com JSP and Servlet Books from Sun Press: http://www.coreservlets.com 2003-2004

More information

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming PSD1B Advance Java Programming Unit : I-V PSD1B- Advance Java Programming 1 UNIT I - SYLLABUS Servlets Client Vs Server Types of Servlets Life Cycle of Servlets Architecture Session Tracking Cookies JDBC

More information

COMP9321 Web Application Engineering

COMP9321 Web Application Engineering COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

More information

A Gentle Introduction to Java Server Pages

A Gentle Introduction to Java Server Pages A Gentle Introduction to Java Server Pages John Selmys Seneca College July 2010 What is JSP? Tool for developing dynamic web pages developed by SUN (now Oracle) High-level abstraction of Java Servlets

More information

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold.

J2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold. 1. Application Servers J2EE Web Development In the beginning, there was darkness and cold. Then, mainframe terminals terminals Centralized, non-distributed Agenda Application servers What is J2EE? Main

More information

Session 11. Expression Language (EL) Reading

Session 11. Expression Language (EL) Reading Session 11 Expression Language (EL) 1 Reading Reading Head First pages 368-401 Sun Java EE 5 Chapter 5 in the Tutorial java.sun.com/javaee/5/docs/tutorial/doc/javaeetutorial.pdf / / / / / Reference JSTL

More information

Array. Prepared By - Rifat Shahriyar

Array. Prepared By - Rifat Shahriyar Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types

More information

JavaServer Pages. Juan Cruz Kevin Hessels Ian Moon

JavaServer Pages. Juan Cruz Kevin Hessels Ian Moon Page 1 of 14 JavaServer Pages Table of Contents 1. Introduction What is JSP? Alternative Solutions Why Use JSP? 2. JSP Process Request Compilation Example 3. Object Instantiation and Scope Scope Synchronization

More information

Session 21. Expression Languages. Reading. Java EE 7 Chapter 9 in the Tutorial. Session 21 Expression Languages 11/7/ Robert Kelly,

Session 21. Expression Languages. Reading. Java EE 7 Chapter 9 in the Tutorial. Session 21 Expression Languages 11/7/ Robert Kelly, Session 21 Expression Languages 1 Reading Java EE 7 Chapter 9 in the Tutorial 2 11/7/2018 1 Lecture Objectives Understand how Expression Languages can simplify the integration of data with a view Know

More information

Integrating Servlets and JSP: The MVC Architecture

Integrating Servlets and JSP: The MVC Architecture Integrating Servlets and JSP: The MVC Architecture Core Servlets & JSP book: More Servlets & JSP book: www.moreservlets.com Servlet and JSP Training Courses: courses.coreservlets.com 2 Slides Marty Hall,

More information

JSP MOCK TEST JSP MOCK TEST IV

JSP MOCK TEST JSP MOCK TEST IV http://www.tutorialspoint.com JSP MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to JSP Framework. You can download these sample mock tests at your local

More information

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC)

Session 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC) Session 8 JavaBeans 1 Reading Reading & Reference Head First Chapter 3 (MVC) Reference JavaBeans Tutorialdocs.oracle.com/javase/tutorial/javabeans/ 2 2/27/2013 1 Lecture Objectives Understand how the Model/View/Controller

More information

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

(800) Toll Free (804) Fax   Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days Course Description This course introduces the Java programming language and how to develop Java applications using Eclipse 3.0. Students learn the syntax of the Java programming language, object-oriented

More information

UNIT 6:CH:14 INTEGRATING SERVLETS AND JSPTHE MVC ARCHITECTURE

UNIT 6:CH:14 INTEGRATING SERVLETS AND JSPTHE MVC ARCHITECTURE UNIT 6:CH:14 INTEGRATING SERVLETS AND JSPTHE MVC ARCHITECTURE NAME: CHAUHAN ARPIT S ENROLLMENT NO: 115250693055 Obtaining a RequestDispatcher Forwarding requests from servlets to dynamic resources Forwarding

More information

JSP. Basic Elements. For a Tutorial, see:

JSP. Basic Elements. For a Tutorial, see: JSP Basic Elements For a Tutorial, see: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/jspintro.html Simple.jsp JSP Lifecycle Server Web

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

SNS COLLEGE OF ENGINEERING, Coimbatore

SNS COLLEGE OF ENGINEERING, Coimbatore SNS COLLEGE OF ENGINEERING, Coimbatore 641 107 Accredited by NAAC UGC with A Grade Approved by AICTE and Affiliated to Anna University, Chennai IT6503 WEB PROGRAMMING UNIT 04 APPLETS Java applets- Life

More information

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format. J2EE Development Detail: Audience www.peaksolutions.com/ittraining Java developers, web page designers and other professionals that will be designing, developing and implementing web applications using

More information

Advance Java. Configuring and Getting Servlet Init Parameters per servlet

Advance Java. Configuring and Getting Servlet Init Parameters per servlet Advance Java Understanding Servlets What are Servlet Components? Web Application Architecture Two tier, three tier and N-tier Arch. Client and Server side Components and their relation Introduction to

More information

Unit 5 JSP (Java Server Pages)

Unit 5 JSP (Java Server Pages) Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic, platform-independent method for building Web-based applications. It focuses more on presentation logic

More information

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web Web A Data Dependency Graph for Web Applications Summary. In this paper, we propose a data dependency graph for web applications. Since web applications consist of many components, data are delivered among

More information

Fast Track to Java EE

Fast Track to Java EE Java Enterprise Edition is a powerful platform for building web applications. This platform offers all the advantages of developing in Java plus a comprehensive suite of server-side technologies. This

More information

Developing JSP components

Developing JSP components jsp.book Page 165 Sunday, September 23, 2001 12:26 PM This chapter covers The JavaBeans API 8 Developing your own JSP components Mixing scriptlets and Beans 165 jsp.book Page 166 Sunday, September 23,

More information

Session 20 Data Sharing Session 20 Data Sharing & Cookies

Session 20 Data Sharing Session 20 Data Sharing & Cookies Session 20 Data Sharing & Cookies 1 Reading Shared scopes Java EE 7 Tutorial Section 17.3 Reference http state management www.ietf.org/rfc/rfc2965.txt Cookies Reading & Reference en.wikipedia.org/wiki/http_cookie

More information

Table of Contents. Introduction... xxi

Table of Contents. Introduction... xxi Introduction... xxi Chapter 1: Getting Started with Web Applications in Java... 1 Introduction to Web Applications... 2 Benefits of Web Applications... 5 Technologies used in Web Applications... 5 Describing

More information

J2EE AntiPatterns. Bill Dudney. Object Systems Group Copyright 2003, Object Systems Group

J2EE AntiPatterns. Bill Dudney. Object Systems Group Copyright 2003, Object Systems Group J2EE AntiPatterns Bill Dudney Object Systems Group bill@dudney.net Bill Dudney J2EE AntiPatterns Page 1 Agenda What is an AntiPattern? What is a Refactoring? AntiPatterns & Refactorings Persistence Service

More information

Component Based Software Engineering

Component Based Software Engineering Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts

More information

20/08/56. Java Technology, Faculty of Computer Engineering, KMITL 1

20/08/56. Java Technology, Faculty of Computer Engineering, KMITL 1 Engineering, KMITL 1 Agenda What is JSP? Life-cycle of JSP page Steps for developing JSP-based Web application Dynamic contents generation techniques in JSP Three main JSP constructs Directives Error handling

More information

Chapter 10 Servlets and Java Server Pages

Chapter 10 Servlets and Java Server Pages Chapter 10 Servlets and Java Server Pages 10.1 Overview of Servlets A servlet is a Java class designed to be run in the context of a special servlet container An instance of the servlet class is instantiated

More information

Developing Applications with Java EE 6 on WebLogic Server 12c

Developing Applications with Java EE 6 on WebLogic Server 12c Developing Applications with Java EE 6 on WebLogic Server 12c Duration: 5 Days What you will learn The Developing Applications with Java EE 6 on WebLogic Server 12c course teaches you the skills you need

More information

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand)

Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand) Oracle - Developing Applications for the Java EE 7 Platform Ed 1 (Training On Demand) Code: URL: D101074GC10 View Online The Developing Applications for the Java EE 7 Platform training teaches you how

More information

Introduction to JSP and Servlets Training 5-days

Introduction to JSP and Servlets Training 5-days QWERTYUIOP{ Introduction to JSP and Servlets Training 5-days Introduction to JSP and Servlets training course develops skills in JavaServer Pages, or JSP, which is the standard means of authoring dynamic

More information

directive attribute1= value1 attribute2= value2... attributen= valuen %>

directive attribute1= value1 attribute2= value2... attributen= valuen %> JSP Standard Syntax Besides HTML tag elements, JSP provides four basic categories of constructors (markup tags): directives, scripting elements, standard actions, and comments. You can author a JSP page

More information

Exercise. (1) Which of the following can not be used as the scope when using a JavaBean with JSP? a. application b. session c. request d.

Exercise. (1) Which of the following can not be used as the scope when using a JavaBean with JSP? a. application b. session c. request d. Exercise 1. Choose the best answer for each of the following questions. (1) Which of the following can not be used as the scope when using a JavaBean with JSP? a. application b. session c. request d. response

More information

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started Application Development in JAVA Duration Lecture: Specialization x Hours Core Java (J2SE) & Advance Java (J2EE) Detailed Module Part I: Core Java (J2SE) Getting Started What is Java all about? Features

More information

Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0

Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0 Sun Sun Certified Web Component Developer for J2EE 5 Version 4.0 QUESTION NO: 1 To take advantage of the capabilities of modern browsers that use web standards, such as XHTML and CSS, your web application

More information

Test Composition. Performance Summary

Test Composition. Performance Summary Example example@mail.com Took test on: Jul 7, 24 Test completion: Normal Test Composition The test consists of 2 sections to be attempted in 6 minutes.section tests the conceptual knowledge of the candidate

More information

CS506 Web Design & Development Final Term Solved MCQs with Reference

CS506 Web Design & Development Final Term Solved MCQs with Reference with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar

More information

Basic Principles of JSPs

Basic Principles of JSPs 5 IN THIS CHAPTER What Is a JSP? Deploying a JSP in Tomcat Elements of a JSP Page Chapter 4, Basic Principles of Servlets, introduced you to simple Web applications using servlets. Although very useful

More information

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines

More information

CST141 Thinking in Objects Page 1

CST141 Thinking in Objects Page 1 CST141 Thinking in Objects Page 1 1 2 3 4 5 6 7 8 Object-Oriented Thinking CST141 Class Abstraction and Encapsulation Class abstraction is the separation of class implementation from class use It is not

More information

Presentation and content are not always well separated. Most developers are not good at establishing levels of abstraction in JSPs

Presentation and content are not always well separated. Most developers are not good at establishing levels of abstraction in JSPs Maintenance and Java Server Pages Jeff Offutt http://www.cs.gmu.edu/~offutt/ SWE 642 Software Engineering for the World Wide Web sources: Professional Java Server Programming, Patzer, Wrox, 14 JSP Maintenance

More information

3. Java - Language Constructs I

3. Java - Language Constructs I Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks

More information

PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II

PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II PES INSTITUTE OF TECHNOLOGY, SOUTH CAMPUS DEPARTMENT OF MCA INTERNAL TEST (SCHEME AND SOLUTION) II Subject Name: Advanced JAVA programming Subject Code: 13MCA42 Time: 11:30-01:00PM Max.Marks: 50M ----------------------------------------------------------------------------------------------------------------

More information

Java.. servlets and. murach's TRAINING & REFERENCE 2ND EDITION. Joel Murach Andrea Steelman. IlB MIKE MURACH & ASSOCIATES, INC.

Java.. servlets and. murach's TRAINING & REFERENCE 2ND EDITION. Joel Murach Andrea Steelman. IlB MIKE MURACH & ASSOCIATES, INC. TRAINING & REFERENCE murach's Java.. servlets and 2ND EDITION Joel Murach Andrea Steelman IlB MIKE MURACH & ASSOCIATES, INC. P 1-800-221-5528 (559) 440-9071 Fax: (559) 440-0963 murachbooks@murach.com www.murach.com

More information

Java Server Pages JSP

Java Server Pages JSP Java Server Pages JSP Agenda Introduction JSP Architecture Scripting Elements Directives Implicit Objects 2 A way to create dynamic web pages Introduction Separates the graphical design from the dynamic

More information

Advantage of JSP over Servlet

Advantage of JSP over Servlet JSP technology is used to create web application just like Servlet technology. It can be thought of as an extension to servlet because it provides more functionality than servlet such as expression language,

More information

CHAPTER 1. Core Syntax Reference

CHAPTER 1. Core Syntax Reference CHAPTER 1 Core Syntax Reference 1 Output Comment Generates a comment that is sent to the client in the viewable page source. JSP Syntax Examples Example 1

More information

Trabalhando com JavaServer Pages (JSP)

Trabalhando com JavaServer Pages (JSP) Trabalhando com JavaServer Pages (JSP) Sumário 7.2.1 Introdução 7.2.2 JavaServer Pages Overview 7.2.3 First JavaServer Page Example 7.2.4 Implicit Objects 7.2.5 Scripting 7.2.5.1 Scripting Components 7.2.5.2

More information

Model View Controller (MVC)

Model View Controller (MVC) Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 5049 Advanced Internet Technology Lab Lab # 11 Model View Controller (MVC) El-masry May, 2014 Objectives To be

More information

Oracle 10g: Build J2EE Applications

Oracle 10g: Build J2EE Applications Oracle University Contact Us: (09) 5494 1551 Oracle 10g: Build J2EE Applications Duration: 5 Days What you will learn Leading companies are tackling the complexity of their application and IT environments

More information

CSC Web Programming. Introduction to JavaScript

CSC Web Programming. Introduction to JavaScript CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its

More information

Modernizing Java Server Pages By Transformation. S h a n n o n X u T h o m a s D e a n Q u e e n s U n i v e r s i t y

Modernizing Java Server Pages By Transformation. S h a n n o n X u T h o m a s D e a n Q u e e n s U n i v e r s i t y Modernizing Java Server Pages By Transformation S h a n n o n X u T h o m a s D e a n Q u e e n s U n i v e r s i t y Background CSER - Consortium for Software Engineering Research Dynamic Web Pages Multiple

More information

CSE 510 Web Data Engineering

CSE 510 Web Data Engineering CSE 510 Web Data Engineering Data Access Object (DAO) Java Design Pattern UB CSE 510 Web Data Engineering Data Access Object (DAO) Java Design Pattern A Data Access Object (DAO) is a bean encapsulating

More information

DEZVOLTAREA APLICATIILOR WEB LAB 4. Lect. Univ. Dr. Mihai Stancu

DEZVOLTAREA APLICATIILOR WEB LAB 4. Lect. Univ. Dr. Mihai Stancu DEZVOLTAREA APLICATIILOR WEB LAB 4 Lect. Univ. Dr. Mihai Stancu J S P O v e r v i e w JSP Architecture J S P L i f e C y c l e Compilation Parsing the JSP. Turning the JSP into a servlet. Compiling the

More information

Java- EE Web Application Development with Enterprise JavaBeans and Web Services

Java- EE Web Application Development with Enterprise JavaBeans and Web Services Java- EE Web Application Development with Enterprise JavaBeans and Web Services Duration:60 HOURS Price: INR 8000 SAVE NOW! INR 7000 until December 1, 2011 Students Will Learn How to write Session, Message-Driven

More information

JAVA 2 ENTERPRISE EDITION (J2EE)

JAVA 2 ENTERPRISE EDITION (J2EE) COURSE TITLE DETAILED SYLLABUS SR.NO JAVA 2 ENTERPRISE EDITION (J2EE) ADVANCE JAVA NAME OF CHAPTERS & DETAILS HOURS ALLOTTED SECTION (A) BASIC OF J2EE 1 FILE HANDLING Stream Reading and Creating file FileOutputStream,

More information

IT6503 WEB PROGRAMMING. Unit-I

IT6503 WEB PROGRAMMING. Unit-I Department of Information Technology Question Bank- Odd Semester 2015-2016 IT6503 WEB PROGRAMMING Unit-I SCRIPTING 1. What is HTML? Write the format of HTML program. 2. Differentiate HTML and XHTML. 3.

More information

Unit 4 Java Server Pages

Unit 4 Java Server Pages Q1. List and Explain various stages of JSP life cycle. Briefly give the function of each phase. Ans. 1. A JSP life cycle can be defined as the entire process from its creation till the destruction. 2.

More information

Trabalhando com JavaServer Pages (JSP)

Trabalhando com JavaServer Pages (JSP) Trabalhando com JavaServer Pages (JSP) Sumário 7.2.1 Introdução 7.2.2 JavaServer Pages Overview 7.2.3 First JavaServer Page Example 7.2. Implicit Objects 7.2.5 Scripting 7.2.5.1 Scripting Components 7.2.5.2

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

CSC309: Introduction to Web Programming. Lecture 11

CSC309: Introduction to Web Programming. Lecture 11 CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat Servlets+JSP Model 2 Architecture 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern 3 Servlets+JSP Model 2 Architecture Controller

More information

ADVANCED JAVA COURSE CURRICULUM

ADVANCED JAVA COURSE CURRICULUM ADVANCED JAVA COURSE CURRICULUM Index of Advanced Java Course Content : 1. Basics of Servlet 2. ServletRequest 3. Servlet Collaboration 4. ServletConfig 5. ServletContext 6. Attribute 7. Session Tracking

More information

Servlet and JSP Review

Servlet and JSP Review 2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com

More information

JSP: Servlets Turned Inside Out

JSP: Servlets Turned Inside Out Chapter 19 JSP: Servlets Turned Inside Out In our last chapter, the BudgetPro servlet example spent a lot of code generating the HTML output for the servlet to send back to the browser. If you want to

More information

JSP (Java Server Page)

JSP (Java Server Page) JSP (Java Server Page) http://www.jsptut.com/ http://www.jpgtutorials.com/introduction-to-javaserver-pages-jsp Lab JSP JSP simply puts Java inside HTML pages. Hello!

More information

The Warhol Language Reference Manual

The Warhol Language Reference Manual The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

More information

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22.

a. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22. Answers 1. What is the super interface to all the JDBC Drivers, specify their fully qualified name? a. Java.sql.Driver i. JDBC-ODBC Driver ii. Java-Native API Driver iii. All Java Net Driver iv. Java Native

More information

Outline. Announcements. Feedback. CS1007: Object Oriented Design and Programming in Java. Java beans Applets

Outline. Announcements. Feedback. CS1007: Object Oriented Design and Programming in Java. Java beans Applets Outline CS1007: Object Oriented Design and Programming in Java Lecture #16 Nov 22 Shlomo Hershkop shlomo@cs.columbia.edu Java beans Applets Reading: finish chapter 7, starting 8 Announcements 4 more lectures

More information

Communication Software Exam 5º Ingeniero de Telecomunicación February 18th Full name: Part I: Theory Exam

Communication Software Exam 5º Ingeniero de Telecomunicación February 18th Full name: Part I: Theory Exam Part I: Theory Exam Duration, exam (this year's students): 3 hours () (last year's students): 2 hours 45 minutes Duration, part I: 2 hours, 30 minutes The use of books or notes is not permitted. Reply

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name Course Code Class Branch : Web Technologies : ACS006 : B. Tech

More information

Web Programming. Lecture 11. University of Toronto

Web Programming. Lecture 11. University of Toronto CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat University of Toronto Servlets+JSP Model 2 Architecture University of Toronto 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern

More information

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional

More information