Java Web Application Development Overview (paste)

Source: Internet
Author: User
Tags contains implement versions client java web tomcat tomcat server advantage
Web Web Development (Web Development) is a feature of JBuilder Professional and Enterprise copyrights. Applet Development is a feature developed by all versions of JBuilder. This section describes Web development technologies. Contains their similarities and differences. Discusses how to decide which technology to use. We first introduce the concepts of these technologies.

Web application Technology

Technical description
Applets
A small Java application that can be downloaded by the browser and run on the browser.

Servlets
Can handle client-requested Java applications running on the server side.

JavaServer Pages (JSP)
An extended servlet technology. JSP focuses on providing a simple way to develop a servlet. They behave differently at development time, but after the first run, the JSP is compiled into a servlet by the Web server.

Internetbeans Express
A component library that provides simplified representation and manipulation of data in a database. This technology is used to join servlet and JSP technology and to simplify the development of data-sensitive servlet and JSP.

This article introduces the basic concepts of these technologies. But how are these technologies used, and what are their advantages and disadvantages? We will provide the answers in the following sections.

Applets
Applets cause a lot of confusion when the Java language is first available. At this time, Web technology has not been greatly developed. The applet then solves some of the challenges faced by developers. In fact, applets have become so popular that developing applets today is an essential part of the Java Learning curriculum. As a result, a common misconception is that Java developers rely too much on applets. Applets should be used in specific situations and are not a magical solution to all web development problems.

The disadvantage of using applets is that:

* It is difficult to distribute and test.
* Depending on whether the client's browser allows Java to run.
* Different browser versions support different versions of the JDK, and are generally not the latest JDK versions.
*applet the first time it started very slowly. Because the client must download it from the server.
* Some of the above problems can have other solutions (not discussed here). When considering using applets, you should first consider whether there are other Java technologies that can accomplish your purpose.

The advantage of using applets is:

*applets can provide a more complex interface than Servlets and JSP.
* Because applets is downloaded from the server and runs on the client, the Web server does not have to support Java. This is important, especially when you are writing a Web application for a site and not having permission to control the Web server. If your site space is provided by an external ISP.
*applet can be verified locally without having to verify it on a remote server. Of course you can also be JavaScript plus a servlet or JSP to complete this function.
* After the applet is downloaded, the number of connection requests that the browser calls to the server will drop. Because a lot of processing will be done on the client's browser.


Servlets

Servlets is a Java program that is integrated with a Web server that runs requests from clients on the server side. They need a Web server that supports JavaServer technology. A tomcat server that is distributed with JBuilder (Tomcat can also be integrated with a Web server that does not support JavaServer technology, such as Micro$oft IIS). Java Servlets can be used in place of common Gateway Interface (CGI) programs, or in the same case where CGI was previously used.

The advantage of using a servlet over CGI is that:
* Reduce memory overhead
* Platform Independent
* The agreement is irrelevant
* You can send a request to the servlet using a client program written in any development language. Customers can be simple to HTML pages. You can also use applets as customers, or programs written in a non-Java language. On the server side, the servlet processes the request and generates dynamic output that is sent to the customer. Servlet generally does not have a user interface. However, you can optionally provide a user interface at the client.

The advantage of using a servlet is that:
* You don't have to worry about whether the client browser is running the JDK. Java can even be shielded from the client's browser. All Java elements are executed on the server side. This makes the Server Manager have more control ability.
* When the servlet starts, the request from the client's browser simply invokes the service () method of the running servlet. This means that customers do not spend as much download time as the applet can cause performance degradation.
* Publishing a servlet on a Web server is the same technique and certainly not impossible. JBuilder provides a number of tools to make publishing easier.


JavaServer Pages (JSP)
JavaServer Pages (JSP) is an extension of the servlet technology. This is a simplified approach that focuses on servlet writing, and focuses more on the presentation of applications.

The main difference between a servlet and a JSP is that for Servlets technology, the logic of the program is kept in a Java file, completely separate from the HTML as the presentation layer. For JSP technology, Java and HTML are merged into a file with a. jsp suffix.

When a Web server processes a JSP file, it first generates a servlet, but when you are developing a JSP, you do not see the generated servlet. In fact, when you compile and run the JSP in a JBuilder IDE environment, you will see the exceptions and processing information reported by the generated servlet. This can be confusing because the information does not accurately locate the line of code in the JSP where the error or exception occurred, and in fact they are just information about the generated code.

The benefits of JSP compared to servlet are:
* Write less code.
* Easy to merge with existing Java beans.
* Release more simple. More publishing issues have been automatically completed for you. Because JSPs is mapped to a Web server the same way as an HTML file.
* You do not have to embed Java code in the JSP-generated servlet. Instead, it is a discrete embedding of Java code in HTML. If you have a careful plan, these blocks of Java code are completely detached from the HTML file, making the JSP more readable.

The disadvantage of using JSP is that:
* Invisible, generated servlet code can cause confusion, as described earlier.
* Since HTML is mixed with Java are in a single file, Java developers must be careful enough to work with web designers to avoid overwriting the other party's updates.
* Combined Java and HTML can result in poor readability, especially if you do not carefully follow a unified programming specification.
*jsp is very similar to the ASP (Active Server Pages). The main difference is that the object of JSP operation is JavaBeans, which has platform-independent nature. The object that ASP manipulates is COM object, can use only on micro$0ft platform.


Internetbeans Express
Internetbeans Express Technology integrates servlet and JSP technology, adds value to your application, and simplifies the development of servlet and JSP. Internetbeans Express is a collection of components, a presentation layer JSP tag library for generating and responding Web applications. It uses static template pages, inserts dynamic content from the active data model, and sends them to the customer. It then overwrites the customer's changes into the data model. This makes it easier to create data-sensitive servlet and JSP.

Internetbeans Express contains built-in dataexpress datasets and datamodules support. It can also be used in conjunction with common data models and EJBS.





Decide what technology to use in Web applications:
Now that you have an overview of comparable web technologies, how do you decide which technologies to use in Web applications? Here are some tips that might help:

* Do you need a complex user interface? If your interface is more complex than data entry elements (text fields, wireless buttons, combo boxes, list boxes, send buttons, and so on) and images, you may use applets.
* If you want to complete a large number of server-side processing, you should choose a servlet or JSP.
* If you want to avoid users downloading a large number of code to add a full application of the startup, you should choose a servlet or JSP.
* If you want to control the JDK version of the application, or if you care about users who do not allow Java to be used in the browser, you should choose a servlet or JSP.
* If you are looking for a CGI replacement, use a servlet or JSP for less memory overhead.
* If you need to be similar to the implementation of ASP, and requirements to implement platform-independent, you should choose JSP.
* If you need a complex user interface, but you want some servlet or JSP features, consider federated applets and servlet, you can use the applet in the client browser, and use the servlet on the server side.
* If you use a servlet or JSP, and want to make the data sensitive, you should choose Internetbeans Express.
*servlet and JSP are very similar, the principle of its selection is a lot of personal hobbies.

Remember: Many Web applications use two or more of these technologies together.





The development process of basic Web applications
No matter what Web technology you choose, the basic steps for developing Web applications and making them run on a Web server are as follows:

* Design Applications
Determine the structure of your application and the technologies it uses. Determine the functionality and appearance of your application. At this stage, you may want to create a webapp.

* Configure your Web server in the JBuilder IDE
You can optionally set up your Web server in the JBuilder IDE so that you can compile, run, debug your application, and post to the same Web server environment later. If you skip this step, JBuilder will automatically compile, run, and debug with the bundled Tomcat.

* Developing Applications
Writing your application's code, whether your application is made up of applets, Servlets, or JavaServer pages, uses JBuilder tools to simplify the task of development.

* Compiling applications
Compile the application in the JBuilder IDE.

* Run the Application
Run the application in the JBuilder IDE. You do not have to distribute, you can preview the application at this time. At this stage, you can make a local test of your application.

* Publish Application
Publish the application to the Web server. The specific steps to publish are closely related to the Web server you choose.

* Test Application
Test the application running on the Web server. This will help you discover problems with your application's publishing, or the application itself. You should test with a client browser on a different machine than the Web server. You can try different types of browsers, because the application may be slightly different in different browsers.





Web applications vs. distributed applications
You might consider using a distributed application rather than a Web application. Both of these are client/server programming. The differences between the two technologies are given here:
* Generally, distributed applications manage and retrieve data from existing systems, and existing systems may exist in a large number of computers running different operating systems. Distributed applications use application servers, such as Borland Applicatoin Server, for application management. Distributed applications do not have to be java-based, in fact, distributed applications can contain different programs, regardless of the language they implement.

* Distributed applications are often configured within a company's intranet. You can enable customers to access your distributed applications over the Internet, but you must work together on distributed applications and Web applications.

The technologies used in distributed applications are common Object Request Broker architecture (CORBA) and Remote method Invocation (RMI):

The main benefit of CORBA is that the client and server can be written in different program development reviews. This possibility is due to the fact that the object is defined by interface definition Language (IDL) and that communication between objects, customers, and servers is implemented by object Request Brokers (orbs).

Remote method Invocation (RMI) allows you to create Java-java distributed applications. In this technique, a remote Java object can directly tune a Java object on another JVM (possibly on another machine).


Web applications can make it available to people who have access to the Internet. You can put it behind a firewall and make it work only in your corporate intranet.

Web applications need to have a browser on the client side, and the server side has a Web server. For example, applets are downloaded to multiple customer platforms and run on the JVM platform provided by the client browser. The servlet and JSP run on a Web server that Java allows to provide jsp/servlet features.

Web applications can be a part of a large distributed application. Distributed applications can also be an enterprise-class, or a part of the application of Java EE. For the Java EE application example and supporting documentation, see Platform 2, Enterprise Edition blueprints in http://java.sun.com/j2ee/blueprints/. The specific chapter is titled "The Client Tier" and "the Web Tier."



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.