In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces what is the difference between JSP and Servlet in JAVA, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.
What exactly is the difference between JSP and SERVLET in application? many people don't know. Let me talk nonsense. To put it simply, SUN first developed SERVLET, its function is relatively strong, and the system design is also very advanced, but it still uses the old CGI way to output HTML statements, which is a sentence output, so it is very inconvenient to write and modify HTML.
Later, SUN introduced a mosaic JSP similar to ASP, which embeds JSP TAG into HTML statements, which greatly simplifies and facilitates the design and modification of web pages. New network languages such as ASP,PHP,JSP are mosaic SCRIPT languages.
From the perspective of network three-tier structure, a network project is divided into at least three layers: data layer,business layer and presentation layer. Of course, it can be more complicated. SERVLET is very powerful for writing business layer, but it is not convenient for writing presentation layer. JSP is mainly designed to facilitate writing presentation layer. Of course, you can write business layer. Friends who are used to writing ASP,PHP,CGI often mix presentation layer with business layer unconsciously. Just like the previous friend, put the database processing information into JSP, in fact, it should be placed in business layer.
According to SUN's own recommendation, only things related to presentation layer should be stored in JSP, that is, only the part of the output HTML page. And all data calculation, data analysis, database connection processing, all belong to business layer, should be placed in JAVA BEANS. Call JAVA BEANS through JSP to realize the integration of the two layers.
In fact, the DNA technology launched by Microsoft not long ago is, in short, ASP+COM/DCOM technology. Just like JSP+BEANS, all presentation layer is done by ASP and all business layer is done by COM/DCOM. Through the call, the integration is realized.
Why use these component technologies? Because the simple ASP/JSP language is very inefficient, if there are a large number of user clicks, the pure SCRIPT language will soon reach its functional upper limit, while the component technology can greatly improve the functional upper limit and speed up the execution speed.
On the other hand, pure SCRIPT language mixes presentation layer and business layer together, which makes it inconvenient to modify and the code can not be reused. If you want to modify a place, it will often involve more than a dozen pages of CODE, using component technology can only reorganize the parts.
To sum up, SERVLET is an early imperfect product, writing business layer is good, writing presentation layer is smelly, and the two layers are mixed.
So, launch JSP+BAEN, write presentation layer with JSP, write business layer with BAEN. SUN himself means to replace SERVLET with JSP in the future.
However, this is not to say that it is useless to learn SERVLET. In fact, you should start from SERVLET, then JSP, then JSP+BEAN.
The emphasis is: if you have learned JSP, you will not use JAVA BEAN and integrate it, which means you have not learned it. Everybody put more effort into JSP+BEAN.
To add a few words:
We can see that when both ASP+COM and JSP+BEAN adopt component technology, all components are compiled first, resident in memory, and then executed quickly. Therefore, the speed advantage of compiling resident memory before executing SERVLET/JSP, which is often boasted, is gone.
On the contrary, ASP+COM+IIS+NT is closely integrated, and there should be a greater speed advantage. Moreover, ASP+COM+IIS+NT development is very efficient, although there are many BUG.
So, why use JSP+BEAN? Because JAVA really has a bright future. After the split of Microsoft, the operating system will rise together, and the developers of application software must find a general development language for development. The time has come for JAVA to dominate the world. If Microsoft's spin-off goes well, the split of the application software company will become the new leader of JAVA. It is disappointing that both SUN and IBM, the big heads of JAVA, are dead. I hope the new company will inject new vitality. However, the new company is likely to launch a JAVA standards war with the old SUN, and both sides develop their own standards, affecting the JAVA boast platform.
In addition, today's machines are getting faster and faster, and the speed disadvantage of JAVA can be overcome soon.
Thank you for reading this article carefully. I hope the article "what is the difference between JSP and Servlet in JAVA" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.