The difference between JSP and JS (Novice must Read) __jsp

Source: Internet
Author: User
Tags microsoft iis

This entry is transferred from the "JSP Advanced Programming" book.

I hope you can distinguish between Chu JSP (Java Server Pages) and JS (Java script) after reading this primer.

I hope these two documents will be helpful to you.

..............................................................................................................
Java Technology
J a V A is an easy to use, fully object-oriented, platform-independent and safe and reliable primary oriented i n T e R n E t
Hair Tools. Since the advent of the 1 9 9 5 years, the rapid development of J a V has transformed the whole of our B world.
With the introduction of the Java servlet, J a V is starting to emerge in E-commerce, the latest Java Server page technology push
, it makes J a V a The preferred development tool for applications based on we B.
To learn the basics of Java Server page,j a V A in the J a V a technology is essential, this book will be in chapter 2nd for no J a V a
The basic reader simply explains the basic syntax and Java beans of J A V, which are the knowledge of J a V that must be mastered prior to learning J S P.
Here, review the development of J a V, and then explain some of the important concepts that will be used later.
1.1.2 JavaBeans
What is J a v a B e a n s. J A V a B e a n s is the reusable component technology of J A V A. A S p extends complex functionality through C O m,
such as file upload, send e m i l and separate business processing or complex computing into independent reusable modules. J S P Pass
The J a V a B e a n has achieved the same function expansion. JSP provides a perfect support for integrating JavaBean components in Web applications
Hold. This support will not only shorten the development time (you can directly utilize the existing components that have been tested and trusted to avoid repeated
, but also provides more scalability for JSP applications. The JavaBean component can be used to perform complex computational tasks, or negative
2 First Part JSP introduction
Download
Accountability and database interaction and data extraction, and so on.
In the actual J s P development process, readers will find that, compared with the traditional a P or P H p page, the J s P page will be
Often concise, because the J a V a B e a n s developed simple, but also can take advantage of the strong function of J a V a language, many dynamic page processing
The process is actually encapsulated in the J a V a B e a n s.
1.1.3 JDBC
J D B C is the J a V-a application interface for executing the S Q L statement, consisting of classes and interfaces written in J a V a language.
The J D B C will be used to access the database in J S p. J D B C is a specification that allows each database vendor to provide the J a V programmer with a standard
Quasi-database access classes and interfaces, making it possible to develop tools and products that are independent of the J a V-a application of D B M S.
The General J A V a development tool is equipped with a J D b c-o D b c Bridge driver, so long as it is able to use the data accessed by O D b C
Library system, you can access it using J D B c. Interestingly, unlike O D B C, which is open Database connectivity
Abbreviation, J D B c is not the abbreviation of Java Database connecivity, but the registered trademark of S U N, at least the official saying is this
Kind of.
1.1.6 Java Servlet
The Java servlet is the foundation of the J s P technology, and the development of a large we-B application requires that the Java servlet and J s p be matched
To complete, here is a brief introduction to the relevant knowledge of S E R v L e T, the development of S E R v L e t will be described in the second part.
S e R v L e t this name probably stems from a P p l e T, now the domestic translation methods are many, this book in order to avoid misunderstanding, decided to directly
With S e R v l e t without any translation, readers, if they want, can be called "Small service Programs". S e R v L e T In fact and the traditional
C G I program and I s a P I, N s a P i etc we b program development tools are the same, after using the Java servlet, the user
It is no longer necessary to use the inefficient C G-I approach, and it is not necessary to use a P-I approach that can only be run on a fixed we-B server platform
Dynamically generate the We-B page. Many we b servers support S E r v L e T, even if we do not directly support S E R v L e T servers can also
Supports S e R v L e via add-on application servers and modules. Thanks to the cross-platform nature of the J a V, S e R v L e T is platform Independent
, in fact, as long as the Java servlet Specification is compliant, S e R v L e T is completely platform-independent and we-B server-independent. Because
The interior of the Java servlet provides services in a threaded fashion, without having to start a process for each request, and using multithreading
The mechanism can serve multiple requests at the same time, so the Java servlet is highly efficient.
But the Java servlet is also not without drawbacks, and the traditional C G I, I s a P I, N s a P I approach the same, the Java servlet is a benefit
Use the output H T M statement to implement dynamic Web pages, if you use the Java servlet to develop the entire Web site, dynamic and static pages
Face integration process is a nightmare. That's why S U N also launches Java Server pages.
1.2 JSP Technology
As I said earlier, the biggest drawback of the Java servlet is that it doesn't separate the logic of the site from the output of the page, causing the entire
S e R v L e T code is cluttered. To address this shortcoming of the Java servlet, S U N launched the Java Server pages-j s P.
1.2.1 JSP Technology Overview
According to the scripting language, which is a language that serves a subsystem, the J S p should be viewed as a scripting language,
And, as a scripting language, J S is too powerful, and almost all of the J a V-a class can be used in J s p.
Chapter I Overview of the total 9
Download
As a text-based, display-centric development technology, J S p provides all the benefits of the Java Servlet, and
When combined with a JavaBeans class, provides a simple way to keep content and display logic separate. Separate content
And the benefit of the display logic is that people who update the appearance of the page don't have to know Java code, and those who update the J a V a B e a n s are not
Must be an expert at designing Web pages, you can use JSP pages with JavaBeans classes to define Web templates to create a
A Web site consisting of pages with similar skins. The JavaBeans class completes the data supply so that there is no Java code in the template,
This means that these templates can be maintained by an HTML writer. Of course, you can also use the Java servlet to control the web
Station logic to separate the logic and content of a Web site by invoking the J S p file through the Java servlet. This chapter will be followed by
This separation of the site's logic and content of the design method to do some more in-depth description.
When you choose to use a Java servlet, or a JSP page, remember that the Java servlet is a program
Design tools, which are most suitable for low-level applications that do not require frequent modification; The J S P page is represented by a display-centric description
The method of sex combines dynamic content with logic. For a simple web-based application that uses a JSP page,
You can use custom tags or S c r i p T e t instead of using the JavaBeans class to combine content with application logic. Custom
The tags are packaged into a tag library and are introduced into a JSP page. S C r I p t l e T is embedded directly in the JSP page
Very small J A V a code snippet.
In general, in the actual J s P engine, the J s p page is compiled, not interpreted, in execution. Explanatory type of
Dynamic Web development tools such as a P, p H p 3 and so on due to speed and other reasons have not met the needs of the current large-scale e-commerce applications
, the traditional development techniques are changed to the way the compiler executes, such as A s p→a s P +;p h p 3→p h p 4. And while J S P's
The spec book does not require the actual J S P engine to use a compiled execution method, but it is generally estimated that it will not use the interpreted side
Type to perform the J S p page. Generally speaking, the J s P page is generally translated to S E R v L e T of J A v a source file, and then through the J a v a compiler
C L A s file compiled to S e R v L e T. Why to compile to S E R v L e t? It is said that the original S E R v L e T engine can be directly
Service to J s P, and the J s P engine just needs to translate J s p to s e R v L e T. Here is to note: J S P Specification Book
There is no provision on how to translate the J s p page to S e R v L e T, so the results of the different J s P engine translation are not the same.
After the J s p file translates to S e R v L e T, each client (usually the user's we-b browser) Requests this J s p from the server
File, the server checks to see if there is a change in the J S p file since the last compilation, and if not, execute directly
S e R v L e t without recompiling, its efficiency is quite high. Generally, the J S p file is compiled in the first user visit
Ask this J S p page when it happens, and this first user is usually the developer himself, so, officially put on the server let
User access to the J s P files generally already have a corresponding compiled S e R v L e T. Many servers have settings that allow J S P
The file is precompiled before the first user accesses it, so the efficiency is higher. The following in the 4th chapter, will show
A simple J s p file corresponds to S e R v L e T.
In the J s p specification, there is no explicit requirement that the program code section in J s P (called S C r I p t l e T) must be written with J a V.
In fact, there are a number of J S p engines that are used in other scripting languages, such as: E M A c-s C r I p t, We b l et cetera, but actually these
The scripting language is also built on the top of J a V, compiled to S e R v L e T to achieve. In accordance with the J S P specification book, completely and J a V a without any clearance
The system S C R I p t l e T is also OK, however, because the strong function of J s p is mainly to be able to and J a V a B e a n S, Enterprise JavaBeans
Work together so that even the Scriptlet section does not use Java, the compiled execution code should be Java-related.
Advantages of 1.2.2 JSP and comparison with other we-B development tools
Compared with the traditional C G I, J S P has a considerable advantage. First of all, in the speed, the traditional C G I program needs to use the system
10 First Part JSP introduction
Download
Standard input to achieve Dynamic Web page generation, while J S p is directly associated with the server. And for C G I to come
says that each visit requires a new process to be added to the process, which is constantly being built and destroyed for the meter as the We server
Counting machines will be a burden. Second, the J S p is designed specifically for we development, and its purpose is to establish a base based on we B
With the program, contains a set of specifications and tools. Using the J s P technology makes it easy to combine a large pile of J s p pages into a
We have a B application.
Compared with i s PA I and n s A p I, the development speed of J s p is much faster and the development difficulty is much smaller, in the compilation of J A V
S e R v L e T, with the current J I T (Just in Ti m e) of the K-a V-a interpreter, its execution speed is not much slower. and
And, I s a P I and N s a P I this and the We B server too close combination of technology in the use of when the error, it is easy to make
Our B server crashes, and J S P does not have this disadvantage.
The real opponents of J s p are a s p and P H p, as well as the forthcoming a s p +, the ratio of a s p, p h p and J s p in we b technology.
See table 1-1.
Note: Here the A s p refers to a s P 3. 0,j s p refers to the J s p Specification Book 1. The specification indicated in 1, p h p means p H p 4.
Table 1-1 The comparison of ASP, J S p, p H p
A s P J s p p H p
We b Server I i S, p w s etc a p a c h e, I i S, P W s,
Netscape server and so on
Run platform wi n d o w s etc various u n i X (S o l a R i s, l i n u x,
A i x, I R i x, etc.), Wi n d o W S
Component technology c o m etc c o m, J a V a B e a n s
Custom TA g syntax no, no
Open and free software
Script language supports v B S c R I p T, J S C R I p t etc p H p
The establishment of a large we b application can be inappropriate
Fast speed of program execution
Low Learning Difficulty
S e s i o n management have et
Unified database connection has, a d o, o D B C, etc.
Suffix name a s p p h p, p h p 3, p H p s
1. We b server and running platform
A S P is currently only supported on Microsoft Internet Information Server (I I S) and personal Web server
(P W s), because I i s and P W s only have the version of WI n d o w S, so a s p is currently only available under the WI n d o w platform. Do
A plug-in with a third party is known to use a s p under U N I x, but for a s p based on C O M component technology, there is no
C O m supported by the U N I x platform can only be a "toy".
The J s P is only a specification, although it can be concluded from the preceding discussion that J s p is generally to be implemented with J a V, but as
Cross-platform language, J a V A can be used on many platforms. In this way, the J S P is also obvious is cross-platform. of the current
Chapter I Overview of the total 11
Download
So a p a c h e, I i S, p W s,
Netscape Server, I P l a n e t
Wait
All kinds of U N I X (S o l a R i s,
L i n u x, A i x, I R i x etc.),
Wi n d o w S, M a c o s etc
And so on J A V a B e a n s and e J B
And so have
And many other cooperation, including S U N,
I b M, BEA We b l o g i c,
N e t s c a P E, O R a C l E
And so on J a V A, E M a c-s C r I p t,
We B and so on
Wait to
Wait very fast
And so low
And so have
Yes, J D B C.
And so on J s P
J S p can be used in a variety of we servers and operating systems. such as Apache WEB Server and Microsoft IIS.
Apache Web Server is the world's most-occupied we B server product and can be included in Sun Solaris, I b M
A I x, SGI IRIX, L i n u X and wi n d o W s are running under many operating systems. Real of J S p under Apache Web server
It is now possible to implement the free Apache Jserv and G N u J S P, J a k a r T a-to M c a T, and you can also use the commercial J r u N
(L I v e s o f t w a r e), we b L o g i c (b e a), we b S P h e r E (i b M) to achieve.
Microsoft IIS itself does not directly support J S p, but can be implemented by J R U N, we b l o g i c, we b S P h e R E.
You can also use the application server to add the Netscape Enterprise Server supported by J S and it can be developed directly
Supports the iplanet Web server for J S p and so on.
P H p itself supports a variety of operating systems and we b servers, p H p can now be used as an additional model for a p a c h E
Block is directly compiled into a p a C h e, because a p a c H e supports a variety of operating systems, p H p can also be used accordingly in various operations
Implemented on the system. P H P can also the C G I way or I s A P i way insert into I i s or P W s to go.
2. Component Technology
A s p and J s P support for component technology has been perfected, while P H p until very recently began to support C O M and J A V a B e a n S.
But support is also not perfect, if P H p can not improve the support of component technology in the future, the large we b application will
It's hard to compete with J s p and a s p. But because the P H p technology itself is easy to learn and easy to use, plus a lot of function support and open source code
Features, in the small and medium we B site development, p H P will still occupy a place.
In fact, the J P itself has no obvious advantage for a P and P H p, and J S is strong because of its strong J a V-a technique behind it.
Operation to do support. J-a V a technology, including J A V a B e a n S and J 2 E-e technology, is the strong vitality of J s p.
M i c R o f t The latest launch of a s p + technology and a s p technology has a lot of exciting progress, but from the enterprise level should
With the point of view, the J S P technology still has considerable advantages. There is reason to think that in the future we development, small and medium site will be
Now J P, A p + and p H p three points world situation, but for large e-commerce sites, J s P and J 2 E-e technology will become the first

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.