简体   繁体   中英

How are jsp pages executed,what's the principle in it?

I'm reading the steps to build a web app skeleton:

http://maestric.com/doc/java/spring/setup#web_app_skeleton

And feel it's greatly different from other languages like PHP.

How is it executed?

web.xml is a deployment descriptor. It does not actually work in a way, the server (servlet container) reads this file to know what your application's needs are (what filters to create, servlets, configuration params etc).

Consider CGI for a second. In a CGI you have code that is executed and outputs HTML. The equivalent of this in Java is a Servlet . You have Java code that includes HTML.

The JSP is a Servlet turned inside out. You have HTML that includes Java code. When "executing" a JSP, the server will in fact turn it inside out and transform it into a Servlet.

The servlet is then executed, not the JSP.

PS this is off course a simplistic description, a lot more is going on behind the scenes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM