1 / 27

Supporting Perspectives for Developing J2EE Applications

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

Download Presentation

Supporting Perspectives for Developing J2EE Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Supporting Perspectives for Developing J2EE Applications 4.1.02

  2. Unit objectives 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

  3. Installed RARs EJB Module JAR file Web Module WAR file Client Module JAR file JSP Pages Servlets HTML, GIFs, etc. EJBs Client Classes J2EE Application -> Modules -> Components J2EE Application EAR file Application DD Web Services DD Web DD Web Services DD EJB DD Client DD

  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 file • Holds the .war and .jar files which are associated with the application • Projects for each J2EE component • Web projects • EJB projects • Client 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 validator • Invoked 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 application • Security roles • EAR roles • EJB roles • EJB references • Resource references

  10. Web Tooling - Web Perspective (1 of 2) • The Web perspective has tools for: • Web project creation • XML, JSP, and HTML file creation, validation, editing • JavaScript editing and validation • Custom JSP tag support (based on JSP 2.0) • web.xml Editor – configuring servlets and JSPs • Servlet creation • WAR file import and export

  11. Web Tooling - Web Perspective (2 of 2) • Additional Web perspective tools: • HTTP and FTP import • FTP export (simple resource copy) to a server • Graphic editing and animation • Cascading Style Sheet (CSS) editing support • Jakarta Taglib availability • Palette View • Struts support • Link viewing, parsing and management • Integration with WebSphere Unit Test Environment • SIP Servlet creation for applications with multimedia conversations • JavaServer Faces and AJAX component layout • Portal 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. Specify Project name Configuration EAR Membership Dynamic Web Project Wizard (1 of 3)

  15. Choose project facets Adds functionality to a project Manages project builders Configurations group facets Dynamic Web Project Wizard (2 of 3)

  16. Dynamic Web Project Wizard (3 of 3) • Set the Context root • http://hostname:port/<contextRoot>/<resource> • Content directory • Class files • Deployment descriptor • JSPs • Servlets • HTML • Other 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 deployment information

  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) Content Assist

  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 for • enterprise applications • EJB, 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 • What J2EE deployment descriptor configures a servlet? How can you edit this file in Application Developer? • Running an application in a test server is as easy as selecting what menu item?

  26. Checkpoint solutions • 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. • Run As > Run on Server

  27. Unit summary 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

More Related