Comparison between ASP and JSP (1)
After Microsoft launched ASP (ActiveServerPage), it was liked by many WEB developers with its powerful functions and easy to learn features. However, it has common problems with Microsoft products and can only be used on Windows platforms. Although it can be used in LINUX by adding controls, its most powerful DCOM control cannot be used. The JSP (JAVA ServerPages) developed by SUN on the basis of Java achieves the separation of dynamic and static pages, which is out of the constraint of the hardware platform, the compilation and post-running methods greatly improve the execution efficiency and gradually become the mainstream development tools on the Internet. To use ASP, programmers can quickly learn JSP. The similarities and differences are as follows:
I. Structure
JSP and ASP are similar in structure, both use "<%" and "%>" as the identifier, the difference is that ASP is a JavaScript or VBScript script between SDKs, while JSP is a JAVA code. JSP separates the form of web pages from the code logic on the server. The JSP page of a server process is first converted into a servlet (a java program running on the server ). Servlet supports HTTP requests and responses. When JSP is converted into pure JAVA code. When multiple users simultaneously request a jsp page, the app instantiation thread responds to the request. These threads are managed by WEB server processes, which are similar to ASP thread manager functions. Compared with the mode in which CGI creates a process for each request, this method is much more efficient.
2. Performance and platform independence
Compared with C ++, VB, and other languages, JAVA is regarded as a language with low efficiency, but it sacrifices efficiency in exchange for platform independence so that JAVA can run on most operating systems without re-compilation-many are willing to pay for it. JAVA compilation code is a byte code, which is interpreted by a Java VirtualMachine (JVM) virtual machine on the operating system at runtime. Byte code can be migrated on all platforms without any changes. Cross-platform programming tends to use the "minimum public denominator" of all operating systems, especially when using graphical interfaces (servlets does not need any graphical interfaces ). Servlets is faster than traditional java programs (applets, javaapp) because they run on the server and do not need to load heavy GUIs (there are very few HTML GUIs ). In addition, the byte code of servlets is only executed when the customer requests it. Therefore, although it takes several seconds to load the first call to servlets, the subsequent requests are very fast, because the server has cached the running servlets. The current jsp server carries the java real-time compiler (JIT). Therefore, JSP execution is faster than the ASP code that needs to be interpreted and executed every time, especially when Cyclic operations exist in the code, the JSP speed is 1 to 2 orders of magnitude faster.
III. Session management
ASP applies the SESSION object to track the user's operation status. JSP uses an object called HttpSession to implement the same function. The Session information is stored on the server, and the Session id is stored in the cookie of the client. If the client disables cookie, the Session Id must be followed by the url. Generally, a 30-minute expiration time is set for a Session on the server. The Session will automatically expire when the customer stops the activity. The stored and retrieved information in the Session cannot be the basic data type (primitivedatatypes) such as (int, double), but must be the corresponding java object (object) such as (Integer, Double ).
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