Why can't JSP replace servlet?

zhaozj2021-02-08  234

JSP dynamic web content may be a great technology for dynamic web content and can be separated from the content and representation of Presentation.

Some people still feel surprised, why servlets still need to be implemented simultaneously with JSP.

In fact, the practicality of servlets is not a problem. They perform very good performance in server-side processing, and they continue to exist due to their attractive installation. In fact, you can view JSP as a senior abstraction of servlets, which is implemented in the form of servlet 2.1 API.

You should not use servlets without selectively; they may not apply to everyone. For example, when a page designer can use the convenient HTML or XML tool to write a JSP page, servlets may be more suitable for developers in the backend because they often use some IDE to write - this is a kind It usually requires higher programming experience.

When sending servlets, even developers have to be careful to ensure that there is no closely combination between Presentation and content. You can usually do this by adding a third-party distribution package such as Htmlkona. But even if you can do this, although you can provide some flexibility through a simple screen, you can not guarantee the changes in Presentation itself. For example, if your presentation changes from HTML to DHTML, you will still need to make sure that the issuing package and new format are consistent, in the worst case - scenario, if a publisher cannot get, you will end in dynamic web Use the handwritten code to Presentation in the content.

So, what is the solution?

One of the methods is to use JSP and Servlet technology to establish an application system.

转载请注明原文地址:https://www.9cbs.com/read-2562.html

New Post(0)