Search code examples
razormodel-view-controllerfaceletstemplatingtemplating-engine

Are view engines and template engines the same thing?


I'm curious as to what is the difference between the two, if there's any.

For example, .net Razor is a view engine/technology or a templating system? JSF's Facelets is a view engine or templating system?


Solution

  • In order of how a typical html page is generated from a .cshtml file.

    1. You create a Razor page (both html/c#)
    2. You request a page (e.g. a View)
    3. The Razor view engine creates a temporary .cs file to generate a .html page with the final output
    4. The generated html is returned

    Therefore this means that .net Razor is 2 components, a templating system but also a View generating engine.

    I don't know too much about JSF Facelets but from the looks of its jsf facelet wikipedia page it is indeed a templating technology.