1 of 34

Introduction to J2EE

2 of 34

Background

  • The Java platform was first introduced in 1995 to address the programming needs for networks and cross-platform programming.
  • In order to address different needs, Sun Microsystems soon split the Java Technologies into three editions:
    1. Java 2 Platform Micro Edition (J2ME)
    2. Java 2 Platform Standard Edition (J2SE)
    3. Java 2 Platform Enterprise Edition (J2EE)

2

3 of 34

J2EE Origin

Sun Microsystems, designed J2EE to define a multi-tier architecture for developing web products to answer the needs from the industry.

Goals:

  • Reduce the cost and complexity of development.
  • Allow J2EE applications to be rapidly deployed and easily enhanced.

3

4 of 34

J2EE

Is a platform that provides a set of components which enable programmer to Develop, Deploy, and Run Java based web application.

4

5 of 34

J2EE Components

  • As said earlier, J2EE applications are made up of components.
  • A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and that communicates with other components

6 of 34

Components

A web component is a software entity that runs in a J2EE environment to provide responses to external requests.

  • Client Components .
  • Server Component :

Web components - Servlets and JSP pages

Enterprise Components – EJB.

7 of 34

J2EE Containers

  • J2EE container is a Java runtime environment which is responsible for managing life cycle of J2EE components.

  • There are five defined container types in the J2EE specification

8 of 34

J2EE Containers

  • Three of these are server-side containers:
    • The server itself, which provides the J2EE runtime environment .
    • A Web container to manage Servlets and JSP pages
    • An EJB container to manage EJB components.
  • The other two container types are client-side:
    • An application container for stand-alone GUIs.
    • An applet container, meaning a browser, usually with the Java Plug-in.

9 of 34

Web App. Layers :

  • Presentation Layer.
  • Business Logic Layer.
  • Data Layer

9

10 of 34

Packaging Applications and Components

  • JAR – Java Archive.
  • WAR – Web Archive.
  • EAR – Enterprise Archive.

11 of 34

Deployment Descriptors

  • Deployment descriptors are included in the Archives, along with component-related resources

  • Deployment descriptors are XML documents that describe configuration and other deployment settings .

  • The statements in the deployment descriptor are declarative instructions to the J2EE container.

12 of 34

Working with HTML

12

13 of 34

What is HTML?

  • Hyper Text Markup Language

  • A markup language designed for the creation of web pages and other information viewable in a browser.

  • The basic language used to write web pages.

  • File extension:- .htm or .html

14 of 34

HTML Tags :

  • Basic HTML Tags.
  • Text Formatting Tags.
  • Anchor Tag.
  • Page Formatting Tags
  • Image Handling Tag.
  • Form Tags.
  • Style Tag.
  • Script Tag.

14

15 of 34

HTML Document Structure

<html>

<head>

<title> Page Title Goes Here </title>

</head>

<body>

content goes here

</body>

</html>

16 of 34

Background

bgcolor

Specifies a background-color for a HTML page.

<body bgcolor="#000000">

<body bgcolor="black">

background

Specifies a background-image for a HTML page

<body background="logo.gif">

<body background="http://www.hpesindia.com/logo.gif">

17 of 34

Text

  • Put text on a webpage
    • <p>Today is my first day at my new job, I’m so excited!</p>

Output:-

Today is my first day at my new job, I’m so excited!

  • Put text in center of a page
    • <center>Hello</center>

Output:-

Hello

  • Put text on the right of a page
    • <p align=“right”>Hello</p>

Output:-

Hello

18 of 34

HTML Tags

  • For example: <b>, <font>,<title>, <p> etc.
  • Tag usually goes with pair: an open tag (<b>) and an end tag (<\b>)

  • Single tag: <hr>,<br>
  • Tags are NOT case sensitive

Effect

Code

Code Used

What It Does

Bold

B

<B>Bold</B>

Bold

Italic

I

<I>Italic</I>

Italic

19 of 34

Font

  • To change text size
    • <font size="+3">Hello</font>
    • Output: Hello

  • To change text color
    • <font color="red">Hello</font>
    • Output: Hello

  • Using both
    • <font size="+3" color="red">Hello</font>
    • Output: Hello

Tag attribute

20 of 34

Commonly Used Character Entities

Result

Description

Entity Name

Non-breaking space

&nbsp;

<

Less than

&lt;

>

Greater than

&gt;

&

Ampersand

&amp;

Quotation mark

&quot;

©

Copyright

&copy;

21 of 34

Headings

  • There are 6 heading commands.

<H1>This is Heading 1</H1>

<H2>This is Heading 2</H2>

<H3>This is Heading 3</H3>

<H4>This is Heading 4</H4>

<H5>This is Heading 5</H5>

<H6>This is Heading 6</H6>

22 of 34

List

  • Unordered list
    • Code:

<ul>

<li>Coffee</li> <li>Milk</li>

</ul>

Output:-

      • Coffee
      • Milk
  • Ordered list
    • Code:

<ol>

<li>Coffee</li> <li>Milk</li>

</ol>

Output:-

      • Coffee
      • Milk

23 of 34

Table

<table border=“1">

<tr>

<th>Heading</th>

<th>Another Heading</th>

</tr>

<tr>

<td>row 1, cell 1</td>

<td>row 1, cell 2</td>

</tr>

<tr>

<td>row 2, cell 1</td>

<td></td>

</tr>

</table>

Heading

Another Heading

Row 1, cell 1

Row 1, cell 2

Row 2, cell 1

24 of 34

Create Links

  • A Hypertext link

< a href="http://www.google.com">Google Home</a>

Output:-

Google Home

25 of 34

Image Formats

  • .gif
    • Graphics Interchange Format
  • .jpeg or .jpg
    • Joint Photographic Experts Group
  • .bmp
    • bitmap

26 of 34

Inserting Image

  • Place all images in the same directory/folder where you web pages are
  • <img src> is a single tag
  • <img src="image.gif">

Output:-

  • Turn an image into a hyerlink

<a href="http://www.hpesindia.com">

<img src="image.gif">

</a>

Output:-

27 of 34

Image Size

  • Computer images are made up of “pixels”
  • <IMG HEIGHT="100" WIDTH="150" SRC="image.gif">

Width

Height

28 of 34

Forms

  • A form is an area that can contain form elements.
  • <form></form>
  • Commonly used form elements includes:
    • Text fields
    • Text areas
    • Combo boxes
    • Lists
    • Radio buttons
    • Checkboxes
    • Submit buttons
    • Reset buttons

29 of 34

Text Input Fields

  • Used when you want the user to type letters, number, etc.

<form>

First name: <input type="text" name="firstname">

<br>

Last name: <input type="text" name="lastname">

</form>

  • Output

First name:

Last name:

30 of 34

Submission Button

  • When user clicks on the “Submit” button, the content of the form is sent to another file.

<form name="input" action="html_form_action.jsp" method="get">

Username: <input type="text" name="user">

<br>

<input type="submit" value="Submit">

</form>

Output:-

Username:

31 of 34

Checkboxes

  • Used when you want the user to select one or more options of a limited number of choices.

<form>

<input type="checkbox" name="bike" value="bike">

I have a bike

<br>

<input type="checkbox" name="car" value="car">

I have a car

</form>

Output:-

I have a bike

I have a car

32 of 34

Radio Buttons

  • Used when you want the user to select one of a limited number of choices.

<form>

<input type="radio" name=“gender" value=“Male"> Male

<br>

<input type="radio" name=“gender” value=“Female"> Female </form>

Output:-

Male

Female

33 of 34

Text Box

  • Used when you want to get input from user.

<form>

<p>Please provide your suggestion in the text box below:</p>

<textarea row="10" cols="30">

</textarea>

</form>

Output:-

Please provide your suggestion in the text box below:

34 of 34

Pull-down Menu

  • Used when you want user to respond with one specific answer with choices you given.

<p>Select a fruit:</p> <select name"Fruit">�<option selected> Apples�<option> Bananas�< option > Oranges�</select>

Output:-

Select a fruit: