The difference between JSP and servlet

Source: Internet
Author: User

First, the concept

Servlet

Servlet is the Java Servlet Java a server-side program written to interactively browse and modify data to generate dynamic Web

means java Servlet servlet run in support java can respond to any type of request, but in most cases Servlet protocol Web

Jsp

JSP full name is java Server Pages, Chinese name is java Server Page, which is simply a simplifiedServletdesign, it is bySun Microsystemscompany advocates, many companies involved in the establishment of a dynamic Web technology standards. Jsptechnology is a little bit similarASPtechnology, it is in the traditional Web pageHtml(subset of standard generic Markup language) files(*.htm,*.html)inserted inJavaProgram Segment(scriptlet)and theJSPMark(TAG), thus formingJSPfile with a suffix named(*.jsp). WithJSPdeveloped byWebapplications are cross-platform and can beLinuxRun on other operating systems.

Second, the difference

  • the JSP is compiled into a Servlet the first time it is run and resides in memory for invocation.

  • JSP is a web development technology,Servlet is a server-side application of small programs, when we visit a JSP page, the server will turn this JSP page into After the Servlet applet runs, the results are fed back to the client's browser.

  • The Servlet acts as a control layer and then calls the corresponding JavaBean to process the data , and finally returns the result to the JSP.

  • The Servlet is used primarily for steering, turning requests to the appropriate JSP pages.

  • JSP More is the page display,servlet is more processing business, that is, JSP is a page,servlet is the way to implement JSP .

  • The servlet can implement all the functions of the JSP, but since the artist uses the Servlet to make the interface very difficult, the JSP was later developed.

  • JSP jsp + Servlet + javabean< Span style= "font-size:16px;font-family: ' The song Body '; > (generally in multi-tier applications , Jsp mainly used as a presentation layer , , servlet javabean

Three, summary

JSP isServletThe expansion of technology is essentiallyServletThe easy way.JSPAfter compilation is the classservlet”。ServletAndJSPThe main difference is thatServletThe application logic is in theJavafile, and completely from the presentation layerHTMLApart. andJSPThe situation isJavaAndHTMLCan be combined into an extension named. JSPThe file.JSPFocus on the view,ServletMainly used for control logic.


This article is from the "Lin Yuanxian blog" blog, make sure to keep this source http://lyhmm.blog.51cto.com/1797932/1948959

The difference between JSP and servlet

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.