With the development of Web technology and the arrival of the e-commerce era, people are no longer satisfied with the establishment of various websites for static information publishing. More often, they need to be able to interact with users, dynamic websites that provide services such as management and control of backend databases.
Dynamic website development technology
Early dynamic website development technology used CGI-BIN interfaces. Developers write separate programs related to interfaces and Web-based applications. The latter calls the former through the Web server. This development technology has a serious scalability problem-each new CGI program requires a new process to be added to the server. If multiple users access the program concurrently, these processes will exhaust all the available resources of the Web server until it crashes.
To overcome this drawback, Microsoft proposed the Active Server Pages (ASP) technology, which simplifies Web application development by using plug-ins and APIs. Compared with CGI, ASP has the advantage that it can contain HTML tags, directly access the database, and use infinitely expanded ActiveX controls. Therefore, it is more flexible in programming. However, this technology is basically limited to Microsoft's operating system platform. The main work environment is Microsoft's IIS application structure, therefore, ASP technology cannot easily implement cross-platform Web server program development.
Hypertext Preprocessor (Hyper Text Preprocessor) is similar to ASP in PHP dynamic website development. It is also a server-side scripting language embedded in HTML documents. Most of its syntax is similar to C, Java, Perl, and other languages, and forms its own unique style. With this language, Web programmers can quickly develop dynamic Web pages. PHP can run on most Unix platforms, GUN/Linux, and Microsoft Windows platforms. PHP has the following advantages: Easy installation, simple learning process, convenient database connection, strong compatibility, strong scalability, and object-oriented programming. However, PHP also has some weaknesses, mainly because PHP is an interpreted language that does not support multi-threaded structures and has limited support for platforms and connected databases, especially in terms of supported standards, PHP is not suitable for some e-commerce applications.
Some other technologies, such as Java Servlets, can be used to easily compile interactive server-side code in Java. A Java Servlets is a Java-based program running on the server and Applet, the latter running on the browser ). Developers write such Java Servlets to receive HTTP requests from Web browsers. dynamically generating responses may require querying the database to complete such requests ), then, send a response containing HTML or XML documents to the browser. This technology is very difficult for common page designers to easily master. In this way, the entire webpage must be created in Java Servlets. If developers or Web administrators want to adjust the page display, they have to edit and re-compile the Java Servlets.
Sun Microsystems Inc .) integrating and balancing existing Java programming environments such as Java Servlets and JavaBeans with the support and cooperation between Web servers, application servers, transaction systems, and development tool vendors) the supported technologies and tools generate a new method for developing Web applications-The assumerver Pages technology JSP ). JSP dynamic website development technology has the following features:
Able to run on any Web or application server;
Separated application logic and page display;
Fast development and testing;
It simplifies the process of developing Web-based interactive applications.
JSP dynamic website development technical method
In order to quickly and conveniently develop dynamic websites, JSP has made improvements in the following aspects, making it the preferred solution to quickly establish a cross-platform dynamic website.
1. Separate content generation and display
With JSP technology, Web page developers can use HTML or XML tags to design and format the final page, the dynamic content on the page is generated by Using JSP identifiers or small scripts based on request changes, such as requesting account information or the price of a specific bottle of wine ). The logic of the generated content is encapsulated in the identifiers and JavaBeans components and bundled in the script. All the scripts run on the server. Because the core logic is encapsulated in the identifiers and JavaBeans, Web administrators and page designers can edit and use JSP pages without affecting content generation.
On the server side, the JSP Engine interprets JSP identifiers and scripts to generate the requested content, for example, accessing the JavaBeans component and accessing the database or containing files using JDBC technology ), and the results are sent back to the browser in the form of HTML or XML) pages. This not only helps the author to protect his own code, but also ensures the full availability of any HTML-based Web browser.
2. reusable components
Most JSP pages depend on reusable, cross-platform components, such as JavaBeans and Enterprise JavaBeans, to execute the complex processing required by applications. Developers can share and exchange components that perform common operations, or make these components used by more users and customer groups. The Component-Based Approach accelerates the overall development process and balances various organizations in their development efforts with their existing skills and optimization results.
3. Identify
Web page developers are not all programmers familiar with the scripting language. JSP technology encapsulates many functions, which are required for dynamic content generation in easy-to-use and JSP-related XML identifiers. The standard JSP mark can access and instantiate the JavaBeans component, set or retrieve component attributes, download the Applet, and execute functions that are more difficult to encode and consume in other ways.
4. Adaptive Platform
Almost all platforms support Java, and JSP + JavaBeans support almost all platforms. Porting from one platform to another, JSP and JavaBeans do not even need to be re-compiled, Because Java bytecode is standard and platform-independent.
5. Database Connection
JDBC is the technology used to connect to the database in Java. Java programs connect to the database through the JDBC driver and perform operations such as querying and extracting data. Sun also developed JDBC-ODBC bridge, using this technology Java program can access the database with ODBC driver, currently most database systems with ODBC driver, therefore, Java programs can Access databases such as Oracle, Sybase, ms SQL Server, and MS Access.
In addition, through the development of the identification library, JSP technology can be further extended. Third-party developers and others can create their own identification libraries for common functions. This allows Web page developers to work with familiar tools and components that execute specific functions like identifiers.
JSP technology can easily be integrated into a variety of application architectures to take advantage of existing tools and techniques, and can be extended to support enterprise-level distributed applications. As part of the Java technology family and the Java 2 Enterprise Edition architecture), JSP technology can support highly complex Web-based applications.
The built-in scripting language of JSP pages is based on Java, and all JSP pages are compiled into Java Servlets. Therefore, JSP pages have all the advantages of Java technology, including robust storage management and security. As part of the Java platform, JSP features the Java programming language "one-time writing, running everywhere.
Application Model for JSP dynamic website development
Using JSP technology, dynamic information is represented by JSP pages. JSP pages are executed by JSP engines installed on Web servers or JSP application servers. The JSP Engine accepts client requests for JSP pages and generates JSP pages as responses to the client.
JSP pages are usually compiled into Java Servlets, which is a standard Java extension. Page developers can access all Java application environments to utilize the scalability and portability of Java technology. When a JSP page is called for the first time, if it does not exist, it will be compiled into a Java Servlets class and stored in the server's memory. This allows the server to respond very quickly in subsequent calls to the page, which avoids the problem that the CGI-BIN generates a new process for each HTTP request ).
JSP pages can be contained in a variety of application architectures or models and can be used in a consortium composed of different protocols, components, and formats. JSP-based dynamic information publishing technology is an open and scalable standard for establishing dynamic web pages. No matter what creation tool is used, developers can use JSP pages to create portable Web applications and run them on different Web application servers.
- Prospect of JSP-based e-commerce website development
- ResultSet problems caused by Microsoft driver in JSP website development
- Analysis on the advantages and disadvantages of JSP
- Advantages of JSP: Application Scope and Performance Comparison
- Flexible Use of JSP and JDBC