JSP practice points

Source: Internet
Author: User

Among many Internet websites, dynamic websites based on Web databases are widely used. A Dynamic Website Based on Web databases is composed of a Web browser as the client interface, a database server for information storage, and a Web application server connecting the two. The CGI technology of the original dynamic website is gradually replaced by Java Applet, ActiveX control, DHTML and JavaScript as the client technology of Web Applications continues to develop. These technologies greatly improve the user interface, but when they try to do some in-depth work, they begin to encounter problems such as client browser incompatibility, server overload, access speed reduction, and security. Jsp (the first choice for SUN Enterprise Applications) technology is a golden key to solve these problems. This article mainly discusses the use of jsp (the first choice for SUN Enterprise applications) some technical problems in the process of building a dynamic website by technology.

Jsp (preferred for SUN Enterprise Applications) Technology

Jsp (the first choice for SUN enterprise-level applications) is a Web development technology based on Java Servlet and the entire Java System. This technology can be used to build an advanced, secure, fast, and cross-platform dynamic website. Adding Java program snippets and jsp (preferred for SUN Enterprise Applications) tags to traditional webpage HTML files constitutes the jsp (preferred for SUN Enterprise Applications) webpage. When the Web server receives a request to access the jsp (preferred for SUN Enterprise Applications) webpage, it first executes the program fragment and then returns the execution result to the customer in HTML format. Program snippets can operate databases, redirect webpages, and send E-mails. This is the function required to build a dynamic website. All program operations are performed on the server. The results are only obtained when the network is uploaded to the client, which has very low requirements on the client browser. 1. When a user connects to a jsp (preferred for SUN Enterprise Applications) website, the user requests a webpage and the jsp (preferred for SUN Enterprise Applications) page responds to the request independently, convert a user's webpage request to a data request, process the request through JavaBean, and encapsulate the returned data into an HTML page and return it to the user.

Jsp (the preferred choice for SUN Enterprise Applications) has many advantages:

1. Write the program once and run it everywhere. Jsp (the preferred choice for SUN Enterprise Applications) fully considers the independence of the application platform during design. Dependent on Java portability, jsp (the preferred choice for SUN Enterprise Applications) is now supported by many popular operating platforms, available on apache (the most popular WEB server platform on Unix), NetScape, IIS, and other servers.

2. Fast execution speed. Jsp (the preferred choice for SUN Enterprise Applications) page only needs to be compiled once and converted to Java byte code, which will remain in the server memory, accelerating the jsp (the preferred choice for SUN Enterprise applications) page response speed. If you do not consider the time spent in the first compilation of the jsp (preferred for SUN Enterprise Applications) page, jsp (preferred for SUN Enterprise Applications) will respond much faster than ASP.

3. Java advantages. Jsp (the first choice for SUN Enterprise Applications) technology uses Java as the scripting language. The cross-platform, mature, robust, and scalable Java technology makes the work of developers easy and simple in other aspects. Java can effectively prevent system crashes when Windows systems are suspected to crash. By providing a method to prevent memory leakage, the Java language is very good at memory management. In addition, jsp (the preferred choice for SUN Enterprise Applications) provides a more robust unexpected event processing mechanism for applications, giving full play to the advantages of Java.

Jsp (preferred for SUN Enterprise Applications) technical difficulties

1. Connect to the database

Database connection is the most important part for dynamic websites. ODBC or JDBC technology can be used to connect to backend databases. Although ODBC is a traditional means of connecting to the database, ODBC has the following fatal defects, making it unable to meet the requirements of jsp (the preferred choice for SUN Enterprise Applications:

(1) ODBC is an API implemented in C language. Calling a local C program from a Java program brings about a series of similar security, integrity, and robustness issues.

(2) Secondly, fully accurate implementation of ODBC from C code ODBC to Java API translation is not satisfactory, because there is no pointer in Java, while ODBC uses a pointer in a large amount, including the error-prone Null Pointer "void *".

(3) Considering the portability of the platform, using ODBC in the Development of jsp (the preferred choice for SUN Enterprise Applications) programs will have a negative impact, making the code unsuitable for porting.

In order to ensure the security, integrity, and robustness of the program, it is more appropriate to use JDBC to connect to the database. JDBC is a Java API that can be used to execute SQL statements. It consists of classes and interfaces written in some Java languages, allowing developers to compile a complete database application in pure Java language. By using JDBC, you can easily transmit SQL statements to almost any database. That is to say, you do not need to write a program to access Sybase, write another program to access Oracle (a large website database platform), and write another program to access Microsoft SQL server (a powerful database platform on WINDOWS ). Programs Written in JDBC can automatically send SQL statements to the corresponding database management system.

In the local database program using Microsoft access (small site favorite) and other databases, you can use Sun company developed JDBC-ODBC bridge, borrow this technology jsp (SUN Enterprise Application preferred) the program can access the database with the ODBC driver. In this way, the advantages of JDBC are retained, and ODBC data sources provided by Microsoft can be used to connect to access (a favorite of small websites. Regardless of the other side of the database, as long as there is an ODBC interface can be directly connected to the database using the JDBC-ODBC bridge, without the need to change the corresponding program code because of the changes in the back-end database, the perfect separation between the application layer and the database layer is achieved. To change the backend database to MySQL (the best combination of PHP and MySQL), you only need to install the MySQL (the best combination of PHP and MySQL) driver in the ODBC data source, you can directly use the MySQL database (the best combination with PHP.

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.