Categories
Online Marketing

Introduction to Java Based Web Development

Piercy’s Introduction to Java Based Network Appplications In this article, We’re going to look at different application. Architectures And you’ll understand the different models for java based web applications. Tim Berners-Lee, a British scientist at CERN the European Organization for Nuclear Research, invented the world wide web. In 1989 He created the web to support better information sharing between scientists around the world.

On April 30, 1993 CERN put the World Wide Web software in the public domain. Cern made the next release available with an open license and the rest is history, And now we can build our own web applications. The basic Web architecture Is a type of client/server network architecture With a client/server network. Some computers on the network will make requests for things. These are the clients, Other computers will act to serve up a response to the client.

These computers are known as servers, For example, when you type or click in your browser for your favorite web site, a request is sent to a server. The server will then try to provide the item or items that are requested In the beginning of the web. Most requests were for static pages. This means we were simply requesting the contents of stored files that did not change, often to be sent back And displayed in our browser.

A dynamic web application is one where the output provided to the client may be different at any moment, based on the current status of data Data that can determine what is viewed by the client may be data provided by the user in a form Data stored. As cookies in the clients, computer and accessed by the application, Current data, like data time of day, the browser used or the operating system Or client behavior on the view that triggers related updates In the dynamic web model, a client will make a request which is sent Over the Internet to the web server, The web server will determine which application to run and will request that the application do stuff At some time.

While the application is processing, it may access storage to get any relevant stuff. It needs to complete the processing. Data can be returned from storage And then the application will create its output. The output will be passed back to the web server, which will in turn, use the output to create a response which will be sent back to the client. The browser will receive the response and render the results We can use Java to make dynamic web applications.

With Java, we have a few different architectures that we can choose from The most basic is known as the Java Model 1 architecture. The model 1 architecture is sometimes adequate for web applications with limited processing requirements With Model 1 JSPs are used to handle all processing, as well as presentation for the application. Jsps are capable of connecting and directing the use of Java classes, which can be applied to take care of the business logic of the application.

Storage can be hard drives with flat files or a database With the Java Model 1 architecture. A request is made by the client. The web server will then request that the JSP do some things. The JSP will start the processing and work with the model which may try to get stuff from storage. Data can be passed back to the application. The JSP will use the data to create the output and then pass the output back to the web server.

The web server will create the response and then pass that back to the client over the Internet, which will render the results When we need more processing power. We’ll use the Java Model 2 architecture. The Java Model 2 architecture follows the more general Model-View-Controller pattern. This pattern is used when we need more significant processing on the server side. The separation of concerns that is inherent in the MVC makes these types of applications easier to create and maintain With the MVC pattern.

The model consists of business objects In the Java world. The model is usually a collection of Java classes. The controller receives the initial request from the web server and makes sure that the application logic is carried out In the Java version. The controller concern is carried out using a Java Servlet component. The view is the component that makes sure the results of processing are ready to send back to the client Java.

Server pages can be used here. The best practice with MVC is to construct each component as independently or loosely coupled as possible, so that, if you need to change one component, Changes to other components are minimized. As with the other architectures, a request can be made, buy the client to the web server. The web server will then ask the servlet or controller to do stuff. The servlet may access Java classes from the model which in turn may access storage to get stuff Once processing is complete.

The results will be passed to the JSP to prepare the output. The output will be passed back to the web server And then the web server, as in other models, will create the response to send back to the client. Many web applications require configuration information so that the server will know how to set up, deploy and connect. The various components of the application With older Java applications, all configuration information is stored in a file called “ web.

Xml.”. The web.Xml file is also referred to as the deployment descriptor The web.Xml file must reside in the WEB-INF directory. You can find this directory in the web content. Folder of your Eclipse projects Here is an example of a web.Xml file for a simple application. This one does not require a lot of configuration. We see a section that defines the welcome file. The welcome file list defines the file names that can be used to indicate which file should run when the application starts.

The three shown here are default, But if you create a web.Xml file, you can edit these to use any welcome file, name that you prefer. This section of the web.Xml file defines How we will access the servlet Note. There are two parts. This part defines a servlet name converter and connects it to the Java class, where we have actually created our servlet TemperatureConversionServlet. The second section connects a URL pattern.

The thing you put in the browser to get the servlet running Here, the URL pattern is /Convert and we are connecting it to the servlet that we named above called converter, So in affect when Convert is sent as a request to the server. It will then run the TemperatureConversionServlet servlet class, Beginning with servlet API 3.0. A new Java API package was introduced called javax.Servlet.Annotation.

This API provides annotation types that can be used for annotating a servlet class. This makes it easier to connect our servlets to URL mappings. If you use annotation, then the deployment descriptor or the web.Xml file is not required to connect your servlets to URL mappings, But we should use later versions of servers For Tomcat. You must use Tomcat 7.0 or later Here’s an example of some of the code from a servlet On line 15.

You can see an example of an annotation, In this case the annotation simple says that there is a URL pattern /Convert. It also provides a description for this servlet. This one line replaces about seven of the lines in the web.Xml file. On the previous slide, This line will indicate to the server that, when the URL mapping /Convert is called or requested, then this particular servlet in which the annotation is embedded, will run With these models in mind, you are now ready to get started.

Learning about the various components of the Java web application architectures For more information. Please visit the references shown here. This article was written, narrated and produced by Dr. Craig A. Piercy. This has been a Piercy Production.


 

By Jimmy Dagger

Find out my interests on my awesome blog!

One reply on “Introduction to Java Based Web Development”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.