Introduction to JSP _jsp programming

Source: Internet
Author: User

JSP (JavaServer pages) is a Dynamic Web page technology standard, which is initiated by Sun Microsystems Company, and is built by many companies, and its Web site is http://www.javasoft.com/products/jsp. This technique provides a simple and quick way to create a Web page that displays dynamically generated content. JSP technology is designed to make it easier and faster to build web-based applications that work with a variety of Web servers, application servers, browsers, and development tools. The JSP specification is the result of extensive collaboration between Web servers, application servers, trading systems, and development tool vendors. Adding Java program Fragments (scriptlet) and JSP tags (tag) to the traditional Web page HTML file (*htm,*.html) forms the JSP Web page (*.jsp). When a Web server encounters a request to access a JSP Web page, it first executes the program fragment in it, and then returns the execution results to the customer in HTML format. Program fragments can manipulate databases, redirect Web pages, and send emails, and so on, which is the functionality required to build dynamic Web sites. All programs operate on the server side, the network sent to the client is only the result of the minimum requirements for customer browsers, can be achieved without plugin, no ActiveX, no Java applets, even without frame.



JSP technology accelerates the development of dynamic Web pages in several ways:
A Separating the generation and display of content
Using JSP technology, Web page developers can use HTML or XML identities to design and format final pages. Use a JSP logo or a little script to generate dynamic content on the page (content varies according to request, such as requesting account information or the price of a particular bottle of wine). The logic for generating content is encapsulated in identity and JavaBeans components, and bundled in small scripts, all scripts run on the server side. If the core logic is encapsulated in logos and beans, then others, such as Web managers and page designers, can edit and use JSP pages without affecting the generation of content. On the server side, the JSP engine interprets JSP IDs and small scripts to generate the requested content (for example, by accessing the JavaBeans component, accessing the database using JDBCTM technology, or including files), and sending the results back to the browser as an HTML (or XML) page. This helps authors protect their own code while ensuring the full availability of any html-based Web browser.



Two Emphasis on reusable components
Most JSP pages rely on reusable, cross-platform components (JavaBeans or Enterprise javabeanstm components) to perform the more complex processing required by the application. Developers can share and Exchange components that perform common operations or make these components available to more users or customer groups. The component-based approach accelerates the overall development process and enables organizations to balance their existing skills and the development efforts of optimized results.



Three Using logo to simplify page development
Web page developers are not all programmers who are familiar with scripting languages. The JavaServer page technology encapsulates a number of features that are needed to make dynamic content generation in an easy-to-use, JSP-related XML identity. The standard JSP identity is able to access and instantiate JavaBeans components, set or retrieve component properties, download applets, and perform features that are more difficult to encode and time consuming in other ways.
JSP technology can be extended by developing a customized identity library. In the future, third party developers and others can create their own identity libraries for common functions. This enables Web page developers to work with familiar tools and artifacts that perform specific functions like identities.
JSP technology is easily integrated into a variety of application architectures to leverage existing tools and techniques and to scale to support enterprise-class distributed applications. As part of the Java technology family and as part of the Java 2 (Enterprise Architecture), JSP technology can support highly complex web-based applications.
Because the built-in scripting language for JSP pages is based on the Java programming language, and all JSP pages are compiled into Java servlet,jsp pages, they have all the benefits of Java technology, including robust storage management and security. As part of the Java platform, JSP has the Java programming language "once written, run everywhere" features. As more and more vendors add JSP support to their products, you can use the servers and tools of your choice, and changing tools or servers does not affect your current application. When integrated with the Java 2 Platform, Enterprise (EE) and Enterprise JavaBean Technologies, JSP pages provide enterprise-class scalability and performance, which is necessary for deploying web-based applications in virtual enterprises.



Four Technical analysis
Microsoft's ASP technology is also a dynamic web development technology. JSP and ASP form very similar, ASP programmer at a glance can recognize <%%> and <%=%>. But there are a lot of differences that can be found in deep exploration, the main one being the following three points:



1, JSP efficiency and security is higher
ASP to the source form storage, to explain the way to run, each ASP Web page calls need to explain the source code, running efficiency is not high. In addition, the IIS vulnerability has caused many web site source program exposure, including the author of the previous use of ASP developed Web site, the ASP program has been downloaded to the people. JSP before execution is compiled into the bytecode (byte code), bytecode by the Java Virtual machine (Java Machine) Interpretation of the execution, more efficient than the source interpretation, the server also has bytecode cache mechanism, can improve the access efficiency of bytecode. The first call to the JSP Web page may be a bit slow because it is compiled into a cache and is much faster later. At the same time, the JSP source program is not likely to be downloaded, especially the JavaBean program can be placed in the wrong directory.
2, the JSP component (Component) way is more convenient
ASP extends complex functions through COM, such as file uploads, sending emails, and separating business processing or complex computing into independent reusable modules. JSP achieves the same function expansion through JavaBean. In the development aspect, the development of COM is far more complex and tedious than JavaBean, it is not difficult to learn ASP, but it is not easy to learn to develop COM. And JavaBean is much simpler, from the above examples in this article can see that the development of JavaBean is very convenient. In terms of maintenance, COM must be registered on the server, and if the COM program is modified, it must be registered or even shut down and restarted. JavaBean do not need to register, put in the classpath contained in the directory on the line. If JavaBean is modified, then JSWDK and Tomcat now need to shut down and rerun (but not shut down), but the developer has promised to do so in later versions without shutting down the server. In addition, JavaBean is a complete oop, can easily set up a reusable object library for different business processing functions, such as user Rights control, email automatic reply and so on.
3, the JSP adapts the platform to be more extensive
ASP is currently available only for NT and IIS. Although there are chilisoft Plug-ins under UNIX to support ASP, the ASP itself has limited functionality and must be augmented by a combination of asp+com, which is difficult to implement under UNIX.
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.