WebLogic Workshop and J2EE

 <  Day Day Up  >  

To best use WebLogic Workshop, you must understand its position in the J2EE and WebLogic Platform landscape. Ultimately, WebLogic Workshop is a tool for building enterprise Web applications. Figure 1.1 shows a simplified version of an enterprise application running on an application server. These tools have existed for a long time, but what makes WebLogic Workshop different is the ease with which J2EE, Integration, and Portal applications can now be developed.

Figure 1.1. Simple Web applications.

graphics/01fig01.gif

Web applications can be divided, as can most applications, into three main aspects:

  • Presentation ” The application's user interface (UI) aspects. In Web applications, presentation is provided by JavaServer Pages (JSPs), HTML, and Web services.

  • Navigation ” These aspects provide a basis for which pages are displayed, based on user actions.

  • Business logic and data access ” These aspects are used to access data and make decisions based on that data for the benefit of navigation.

Figure 1.2 shows a more sophisticated environment for application deployment: WebLogic Platform. Workshop works with WebLogic Platform, giving developers full access to its features. Although Figure 1.2 isn't intended to be an architectural diagram of WebLogic Platform, you can see how domains contain definitions of services that are available to all servers and the clusters they contain. Clusters, servers, domains, and other production administration features are covered in Chapter 15, "Taking Your Applications from Development to Production."

Figure 1.2. Domains, clusters, Web servers, and applications.

graphics/01fig02.gif

DOMAINS, CLUSTERS, AND SERVERS

WebLogic Platform has a number of mechanisms for deploying applications. At the root of the deployment tree is a server, and applications are normally deployed on servers. Servers can be grouped into logical sets known as clusters . From a client's perspective, a cluster looks and acts exactly like a single server. From a developer's perspective, machines with different capabilites can be combined into a single cluster for the purposes of load balancing, fault tolerance, or support of mixed server features. Domains are groups of servers (clusters) defined to support specific Framework services (such as portals) and integration of combinations, and they can be used to create reuseable templates.


During the past five or six years , Web applications were built by using several core technologies. Page presentation was handled by hard-coded HTML and dynamic JSPs, all coded by hand. In more sophisticated applications, page navigation was handled by servlets, but more often than not it was hard-coded into JSPs. Data access and business logic were handled by EJBs and Java Database Connectivity (JDBC). In fact, the J2EE landscape isn't all that different today; most applications are still developed painstakingly by hand using these same technologies. So where does WebLogic Workshop fit in?

J2EE provides a component-based architecture for developing an enterprise application quickly and efficiently . This component architecture divides application logic into manageable units. WebLogic Workshop builds Web applications based on the Model-View-Controller (MVC) pattern, which helps separate an application's activities into functional areas. MVC also enforces security on the data ”the Model part of MVC ”which means that data shouldn't be allowed to change unless it's processed through a business process. Controllers are objects responsible for routing requests to the appropriate business component to process the data and forward it to the View component for display. Workshop supports the MVC pattern by implementing a component-based architecture.

The View Component

In J2EE, JSPs are used as the View component. JSPs are components used to generate dynamic content as a response to a client request. The Java code for generating the dynamic presentation is written within tags, which are the standard tags provided by the JSP specification or custom tags you have developed.

Workshop enables you to build these JSPs through GUI-based editors and also provides a set of custom tags, known as the NetUI tag library . This library contains tags for most of the popular features used when developing JSPs, such as creating links, buttons , tables, and so on. Without this library, you would have to write a considerable amount of code to build these elements on your own, but with the NetUI library, these tasks are quick and straightforward.

When you create a JSP in Workshop, you don't have to enter the code for using these tags. Workshop offers a number of ease-of-use features, such as name completion and tag palettes. You can simply drag a tag from one of the palettes to the JSP.

The available NETUI tags and details on how to use them are explained in Chapter 7, "Using the NetUI Tag Library Toolbox to Develop Sophisticated JSPs."

The Controller Component

In J2EE, servlets act as Controllers that route requests to the appropriate Model component. Normally, you must hard-code the application flow in these components to create navigation logic, which makes it difficult to adapt to change.

Workshop introduces a framework called Page Flow that acts as a Controller in the MVC model. A Page Flow is an easy-to-use GUI-based tool for connecting pages with snippets of navigation code known as actions . Actions are small bits of decision logic built visually through drag-and-drop that can access underlying Model data to control page navigation. Application flow is stored as annotations, and the code is generated at runtime. Using Page Flows, discussed in more depth in Chapter 4, "Developing with Page Flow," makes it easy to adapt to change.

The Model Component

In J2EE, EJBs are used for processing data and form the Model component of MVC. There are four kinds of EJBs:

  • Stateless session beans are short-lived synchronous beans that do not maintain any client information. All instances of the same stateless session bean are identical.

  • Stateful session beans are synchronous and maintain some client information, but only for a temporary period. This information is not stored persistently and is lost when the bean instance is destroyed .

  • An entity bean represents persistent data. The data is saved before the bean instance is destroyed.

  • Message-driven beans (MDBs) are stateless beans that allow business components to receive messages asynchronously.

For Model component support, WebLogic Workshop introduces a new type of component known as a control . Controls are completely integrated into the Workshop environment and have a predefined set of methods and properties that specify the business logic. Two types of controls can be used in Workshop:

  • Built-in controls, such as rowset controls, have predefined methods for creating, reading, updating, and deleting records from a database.

  • Custom controls can be created to leverage complex business logic across different applications.

The Workshop Framework compiles and runs these controls as EJBs. Chapters 6, "Introduction to WebLogic Workshop Controls and Components," and 8, "Advanced Control Development," examine the different types of controls that can be used in Workshop for processing data.

Applications built with Workshop follow the J2EE standards for packaging. All View and Controller components are packaged as a Web Application Archive (WAR) file, and all Model components are packaged as a Java Archive (JAR) file. The entire application is deployed as an Enterprise Archive (EAR) file. Chapter 3, "WebLogic Workshop Application Development Basics," explains the directory structure Workshop uses when building applications.

 <  Day Day Up  >  


BEA WebLogic Workshop 8.1 Kick Start
BEA WebLogic Workshop 8.1 Kick Start: Simplifying Java Web Applications and J2EE
ISBN: 0672326221
EAN: 2147483647
Year: 2004
Pages: 138

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net