Java EE vs JSP vs JSF [closed]

Is JSP “dead” in favor of JSF?

JSF has countless benefits over JSP. For instance:

  • It defines a MVC approach
  • It set up componentization standards
  • It has apply values feature
  • Built-in AJAX
  • A defined view context control
  • Allows for rich interfaces extensions like Primefaces

And we can go on and on.

You can still use JSP for other scenarios where you need some specific flexibility or performance, and the same thing for servlets, but JSF pretty much replaced JSP for “robust” applications.

Now, I am a huge fan of JSF, but it has a long way to go. JSF 2.2 kinda looks like a mature framework now that it has a defined navigation standard (FacesFlow), and we just had a built-in file uploader in 2.1 and it is not even AJAX, and there’s “HTML5”, etc. So yeah, there is a lot more work to be done that I won’t detail in here.

In my experience, JSP is in fact “dead” if compared to JSF and other frameworks like Spring MVC and others. Java EE 7 tutorial barely says anything about JSP. But it is not dead dead, since it is already supported in Web Containers and you can still use it.

Is Java EE the platform JSF runs on top of or something different
altogether?

JSF is part of Java EE but you do not need full Java EE profile in order to use JSF. Examples:

  • Tomcat is just a Java EE Web Profile implementation, and you can use
    JSF in Tomcat.
  • You can use JSF in JBoss but you do not need JMS enabled in order to JSF to work.

Java EE components are modular, and you only need a Web Profile server/container in order to use JSF.

Is JSF merely an MVC framework for developing web applications?

Yes (but I wouldn’t say merely). Each one has it own pros and cons. But the principle is the same.

One could argue about integration with EJB, but so is Spring MVC with its own container.

Is JSF a framework developed by Oracle and part of Java, or is it a
separate framework altogether (Much like the Zend Framwork is from
PHP)?

Oracle now delegates to teams to define specification. In theory, you can implement your own JSF if you want. I do not know about PHP’s Zend Framework.

Most common JSF implementations are Mojarra and MyFaces. (Luiggi beat me on this right now, you can check his links).

[Bonus] Would you recommend learning jsp or jsf?

I would recommend both. JSP first and JSF after it.

But I would 100% recommend you to use JSF for you projects. But make sure you understand componentization and all the stuff that makes JSF a powerful tool.

Also check out JSF 2.2 new features, this page is awesome for an intro on the latest features added to the framework.

Leave a Comment

tech