JMS and the Web
In the two-tier model, a web client application, which is contained by a web server in addition to other services like JMS or JDBC, consists of the presentation layer and the business layer. Although you can put the business logic layer in a standard (nonenterprise) JavaBean and design a JSP application to access its method to perform actions, it still must be classified as a two-tier model unless there is no application server layer between the client and the data layer. Web components (Java servlets or JSP files) on a web server are accessed by a web client through a web browser.
Figure 1 illustrates the JMS and web architecture in a two-tier model.
Figure 1 The architecture of a two-tier model with JMS and a web application.
In the web components, you can write source code to access (send to or receive messages from) a JMS provider. These components reside in the web server, and web clients can call these components. A web server provides a connection between a web client and a JMS provider. If the web client is a producer client, a message is delivered to the destination created in the JMS provider. If the web client is a consumer client, a message is delivered to the client from the destination in the JMS provider.
In the following section, I provide a sample web client application as well as the source code.