views:

120

answers:

2

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 ASP.NET equivilant is)?

What other technical differences should I be aware of with JSP and ASP.NET (MVC 2)?

+3  A: 

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.

ewernli
Points for answering the **actual** difference. JSP is a view technology. ASP.NET MVC is a component based MVC framework. It's comparing apples with oranges. JSP is best to be compared with "classic ASP" and ASP.NET MVC with JSF.
BalusC
Hmmm, he did answer "part" of the question. I answered the first, and more talked about portion.
Derrick
+1  A: 

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.

Derrick
Here's more about ASP.NET pre compilation:http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx
Derrick