Technical differences between ASP.NET and Java Servlets / JSP

前端 未结 2 1807
谎友^
谎友^ 2021-02-08 06:42

My understanding of JSP is that every JSP page on first load is compiled into a Java Servlet. Is this the same for ASPX pages (of course, not into a servlet, but whatever the AS

相关标签:
2条回答
  • 2021-02-08 06:51

    ASP can vaguely compare to JSP / Servlet. ASP.NET can vaguely compare to JSF (build on top of Servlet/JSP).

    ASP.NET and JSF are both component-based frameworks, while JSP and ASP are mostly view technologies.

    Done correctly, JSP/Servlet can be used to have an action-based approach where a controller process a command and forward to a view for rendering (MVC), which decouple view rendering from the business logic.

    But the approach taken by component-based framework is different and each component can trigger callbacks (business logic) and is responsible to render itself. They also rely on the concept of data binding, which does not exist as is in action-based framework.

    Component-based model are closer to programming model for desktop application, but abstract away the webby nature of the application. This is good and bad at the same time. It's bad when you want to optmize web-related things such as friendly URL, etc. That's I think why Microsoft introduced later on an action-based MVC framework next to ASP.NET.

    0 讨论(0)
  • 2021-02-08 06:52

    JSP pages are translated into Java source code, then compiled into class files (containing Java Byte Code) for future execution. After that, they're actually JIT (Just In Time) compiled by the JVM when they are needed for execution (so they're pretty fast).

    It's my guess that there's a similar process for .NET applications, in that they are compiled into .NET assemblies. This is sort of like Java's class files, except they are IL (Intermediate Language) to run on the CLR. At run time, IL is also translated into native machine instructions for execution.

    The actual build / runtime mechanisms (from a high level) are probably surprisingly similar.

    EDIT

    Here are some details regarding ASP.NET : http://msdn.microsoft.com/en-us/library/ms366723.aspx

    Also, with Java based web applications, containers which run them can be configured to pre-compile JSPs when the application is deployed. Then, the JVM loads the class files into memory, and handles JIT compilation / caching from that point forward.

    0 讨论(0)
提交回复
热议问题