Supporting Perspectives for Developing J2EE Applications

Post on 02-Jan-2016

26 views 0 download

description

Supporting Perspectives for Developing J2EE Applications. 4.1.02. Unit objectives. After completing this unit, you should be able to: Create enterprise application projects in WebSphere Studio Application Developer - PowerPoint PPT Presentation

transcript

®

IBM Software Group

© 2007 IBM Corporation

Supporting Perspectives for Developing J2EE Applications

4.1.02

2

After completing this unit, you should be able to: Create enterprise application projects in WebSphere Studio

Application Developer Use the various Application Developer perspectives involved

in developing and testing Web components Perform the basic steps necessary to build and test a simple

servlet

After completing this unit, you should be able to: Create enterprise application projects in WebSphere Studio

Application Developer Use the various Application Developer perspectives involved

in developing and testing Web components Perform the basic steps necessary to build and test a simple

servlet

Unit objectives

3

J2EE Application -> Modules -> Components

WebDD

EJBModuleJAR file

WebModule

WAR file

ClientModuleJAR file

J2EEApplication

EAR file

InstalledRARs

HTML,GIFs, etc.

JSPPages

ApplicationDD

Web Services

DD

ClientClasse

sEJBs

EJBDD

Web Services

DD

ClientDD

Servlets

4

Application Developer Project Mapping Resources organized in a parallel structure to the J2EE

application Enterprise application project corresponds to the J2EE

application itself Manages the application.xml fileHolds the .war and .jar files which are associated with the

application Projects for each J2EE component

Web projectsEJB projectsClient application projects

5

Building a Simple Enterprise Application A developer uses several different perspectives when

developing and testing an enterprise application Example: building a simple servlet Steps include:

Creating an enterprise application project and associated module projects (Web module for servlet)

Importing and creating module artifacts (create servlets, JSPs, and Web pages)

Adding enterprise application project to a server configuration (run on server)

Launching server in debug mode

6

Creating an Enterprise Application Project Launch the New Enterprise Application Project wizard Designate a name for the project Choose the Target Runtime that defines the application server

type and version

7

Manage Project Facets Project facets allow users to add and remove functionality from

a project Select a facet to display a description Right-click a facet and Show Constraints (the hover box)

8

Add or Create Additional Modules Optionally select existing module projects to add to the EAR

project, or create new ones

9

EAR Validator Application Developer projects can have an associated

validatorInvoked on save or explicitly from the context menu

The enterprise application project validator validates the following resources:Deployment descriptor (application.xml)All modules contained in the enterprise applicationSecurity rolesEAR rolesEJB rolesEJB referencesResource references

10

Web Tooling - Web Perspective (1 of 2) The Web perspective has tools for:

Web project creationXML, JSP, and HTML file creation, validation, editingJavaScript editing and validationCustom JSP tag support (based on JSP 2.0)web.xml Editor – configuring servlets and JSPsServlet creationWAR file import and export

11

Web Tooling - Web Perspective (2 of 2) Additional Web perspective tools:

HTTP and FTP importFTP export (simple resource copy) to a serverGraphic editing and animation Cascading Style Sheet (CSS) editing support Jakarta Taglib availabilityPalette ViewStruts supportLink viewing, parsing and managementIntegration with WebSphere Unit Test EnvironmentSIP Servlet creation for applications with multimedia

conversationsJavaServer Faces and AJAX component layoutPortal Application and Portlets

12

Web Perspective View and edit Web components: Servlet, JSP and others

13

Wizards A series of wizards assist in creating Web assets

Create a Web Page• HTML/XHTML• JSP• JSP Fragment

14

Dynamic Web Project Wizard (1 of 3) Specify

Project nameConfigurationEAR Membership

15

Dynamic Web Project Wizard (2 of 3) Choose project facets

Adds functionality to a project

Manages project builders Configurations group facets

16

Dynamic Web Project Wizard (3 of 3) Set the Context root

http://hostname:port/<contextRoot>/<resource> Content directory

Class filesDeployment

descriptorJSPsServletsHTMLOther support files

17

Create Servlet Wizard (1 of 3) Specify Class name and Java package Select an existing servlet class

To reuse it with different parameters or mappings Select Annotations

To generate deploymentinformation

18

Create Servlet Wizard (2 of 3) URL mappings that will invoke the servlet

http://hostname:port/<contextRoot>/<URLMapping> Name and description Parameters in web.xml

19

Create Servlet Wizard (3 of 3) Specify class modifiers, interfaces and desired method stubs

20

Developing Servlets Edit Java code using the Java Tooling Can configure servlets within a Web module by editing

web.xml file (deployment descriptor)

21

Page Designer Design View, Source View, Preview Content Assist available (Ctrl-Space)

ContentAssist

22

Run on Server To test a Web application, choose an element to invoke via

URL For example, an HTML page, JSP, or servlet)

Select Run As > Run on Server from the context menu

23

Servers View Allows creation, configuration and control of servers WebSphere Application Server 6.1 appears by default The list of applications deployed to the server appears in a tree

24

Test Environments and Server Configuration WebSphere Application Server

V7.0 is the default server forenterprise applicationsEJB, and Web projects

The server administrative console is use to configure the server

Projects can be run on different servers types and versions

25

Checkpoint

1. What J2EE deployment descriptor configures a servlet? How can you edit this file in Application Developer?

2. Running an application in a test server is as easy as selecting what menu item?

26

Checkpoint solutions

1. The Web Deployment Descriptor resides in the file web.xml. You can locate web.xml, or by double-click on the Deployment Descriptor entry near the top of every Web project in the Project Explorer.

2. Run As > Run on Server

27

Having completed this unit, you should be able to: Creating enterprise applications and Web projects in

Application Developer Create a servlet in the Web perspective Perform the basic steps necessary to build and test a simple

servlet

Having completed this unit, you should be able to: Creating enterprise applications and Web projects in

Application Developer Create a servlet in the Web perspective Perform the basic steps necessary to build and test a simple

servlet

Unit summary