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