supporting perspectives for developing j2ee applications

27
® IBM Software Group © 2007 IBM Corporation Supporting Perspectives for Developing J2EE Applications 4.1.0 2

Upload: zenia-hensley

Post on 02-Jan-2016

29 views

Category:

Documents


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

Page 1: Supporting Perspectives for Developing J2EE Applications

®

IBM Software Group

© 2007 IBM Corporation

Supporting Perspectives for Developing J2EE Applications

4.1.02

Page 2: Supporting Perspectives for Developing J2EE Applications

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

Page 3: Supporting Perspectives for Developing J2EE Applications

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

Page 4: Supporting Perspectives for Developing J2EE Applications

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

Page 5: Supporting Perspectives for Developing J2EE Applications

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

Page 6: Supporting Perspectives for Developing J2EE Applications

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

Page 7: Supporting Perspectives for Developing J2EE Applications

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)

Page 8: Supporting Perspectives for Developing J2EE Applications

8

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

project, or create new ones

Page 9: Supporting Perspectives for Developing J2EE Applications

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

Page 10: Supporting Perspectives for Developing J2EE Applications

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

Page 11: Supporting Perspectives for Developing J2EE Applications

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

Page 12: Supporting Perspectives for Developing J2EE Applications

12

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

Page 13: Supporting Perspectives for Developing J2EE Applications

13

Wizards A series of wizards assist in creating Web assets

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

Page 14: Supporting Perspectives for Developing J2EE Applications

14

Dynamic Web Project Wizard (1 of 3) Specify

Project nameConfigurationEAR Membership

Page 15: Supporting Perspectives for Developing J2EE Applications

15

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

Adds functionality to a project

Manages project builders Configurations group facets

Page 16: Supporting Perspectives for Developing J2EE Applications

16

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

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

Class filesDeployment

descriptorJSPsServletsHTMLOther support files

Page 17: Supporting Perspectives for Developing J2EE Applications

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

Page 18: Supporting Perspectives for Developing J2EE Applications

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

Page 19: Supporting Perspectives for Developing J2EE Applications

19

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

Page 20: Supporting Perspectives for Developing J2EE Applications

20

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

web.xml file (deployment descriptor)

Page 21: Supporting Perspectives for Developing J2EE Applications

21

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

ContentAssist

Page 22: Supporting Perspectives for Developing J2EE Applications

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

Page 23: Supporting Perspectives for Developing J2EE Applications

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

Page 24: Supporting Perspectives for Developing J2EE Applications

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

Page 25: Supporting Perspectives for Developing J2EE Applications

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?

Page 26: Supporting Perspectives for Developing J2EE Applications

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

Page 27: Supporting Perspectives for Developing J2EE Applications

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