Presentation is loading. Please wait.

Presentation is loading. Please wait.

SUN J2EE Architecture (Introduction, J2EE Patterns, Samples)

Similar presentations


Presentation on theme: "SUN J2EE Architecture (Introduction, J2EE Patterns, Samples)"— Presentation transcript:

1 SUN J2EE Architecture (Introduction, J2EE Patterns, Samples)
-- Understanding the SUN J2EE Architecture -- © Josef Schiefer, IBM Watson

2 Tiered Approach (5 Tiers)

3

4 Front Controller / Dispatcher

5 Front Controller Interaction

6 Front Controller Alternatives…

7 Servlet Front Controller

8 JSP Front Controller

9 JSP Front Controller – JSP Code
contentType="text/html"%> page import="corepatterns.util.*" %> <html> <head><title>JSP Front Controller</title></head> <body> <h3><center> Employee Profile </h3> <% /**Control logic goes here... We either dispatch to another JSP at this point or simply allow the remaining portions of scriptlet code to execute**/ String page; /**ApplicationResources provides a simple API for retrieving constants and other preconfigured values**/ ApplicationResources resource = ApplicationResources.getInstance(); try{ RequestHelper helper = new RequestHelper(request); // Use a helper object to gather parameter Command cmdHelper= helper.getCommand(); // Command helper perform custom operation page = cmdHelper.execute(request, response); } catch (Exception e){ request.setAttribute(resource.getMessageAttr(),"Exception occured : " + e.getMessage()); page = resource.getErrorPage(e); } // dispatch control to view if(page!=null){ RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(page); dispatcher.forward(request, response); %> <FORM method=POST > <table width="60%"> <tr> <td> Not detected next page </td> </tr> </table> </FORM> </body> </html>

10 Servlet Controller Strategy

11 Command & Controller Strategy

12 Screen Mappings <request-mappings>
<screen-definition url="/WEB-INF/xml/screendefinitions.xml" language="en_US"/> <screen-definition url="/WEB-INF/xml/ja/screendefinitions.xml" language="ja_JP"/> <default-screen>MAIN</default-screen> <signin-screen>SIGN_IN</signin-screen> <signin-error-screen>SIGN_IN_ERROR</signin-error-screen> <url-mapping url="/main" screen="MAIN"/> <url-mapping url="/search" screen="SEARCH"/> <url-mapping url="/category" screen="CATEGORY"/> ….. <url-mapping url="/verifysignin" screen="SIGN_IN_SUCCESS" useRequestHandler="true" useFlowHandler="true"> <request-handler-class>com.sun.j2ee.blueprints.petstore.control.web.handlers.SigninHandler</request-handler-class> <flow-handler class="com.sun.j2ee.blueprints.petstore.control.web.handlers.SigninFlowHandler"> <handler-result result="2" screen="SIGN_IN_ERROR"/> <handler-result result="1" screen="SIGN_IN_SUCCESS"/> </flow-handler> </url-mapping> <exception-mapping exception-class="com.sun.j2ee.blueprints.petstore.control.exceptions.SigninFailedException" screen="SIGN_IN_ERROR"/> </request-mappings>

13 Screen Definitions <screen-definitions>
<template>/template.jsp</template> <screen> <screen-name>main</screen-name> <parameter key="title" value="Welcome to the BluePrints Petstore" direct="true"/> <parameter key="banner" value="/banner.jsp" direct="false"/> <parameter key="sidebar" value="/sidebar.jsp" direct="false"/> <parameter key="body" value="/main.jsp" direct="false"/> <parameter key="mylist" value="/mylist.jsp" direct="false"/> <parameter key="advicebanner" value="/advice_banner.jsp" direct="false"/> <parameter key="footer" value="/footer.jsp" direct="false"/> </screen> <screen-name>cart</screen-name> <parameter key="title" value="Cart" direct="true"/> <parameter key="body" value="/cart.jsp" direct="false"/> …. </screen-definitions>

14 Example – Flight Reservation

15 Screen Flow Management / Controllers

16 Class Model – Web Application

17 Class Diagram - Flight Management

18 Controllers/Events/Actions

19 Typical Web Request

20 Price Itinerary

21 Component Diagram

22 Summary 5 Tiers Architecture
Event objects are used to pass data between the layers Heavy usage of local interfaces for EJBs (support of fine-grained objects) Web Action / EJB Actions Web Controller / EJB Controller EJB/Web Packaging Screen Dispatchers / Screen Management / Screen Mappings J2EE Patterns J2EE Blueprints


Download ppt "SUN J2EE Architecture (Introduction, J2EE Patterns, Samples)"

Similar presentations


Ads by Google