1

I asked my teacher in class that Java Server Faces will work on Apache Tomcat. But he then corrected me saying that Tomcat is a Web Server not an Application Server, hence it will not run Java Server Faces.

My question is what is the difference between an Application Server and a Web Server?
What is it about Apache Tomcat that is can run JSPs and Servlets but not JSFs?

prometheuspk
  • 121
  • 3

2 Answers2

6

Tomcat is definitely an application server, as it will happily process Java server-side code in order to generate dynamic contents, while instead a "pure" web server (like Apache) can only serve static web pages; so your teacher is totally wrong here.

What is right is that Tomcat doesn't provide native JSF support; but the more than 4500000 results shown by a simple Google search for Tomcat + JSF are quite explicit in showing that Tomcat can indeed run Java Server Faces.

Massimo
  • 70,200
  • 57
  • 200
  • 323
5

They're often the same, but technically an app server is not limited to HTTP requests, and is often behind a web server and provides "business logic" in the form of web service calls which are used to construct the actual resources requested by the end user. See this for more: http://www.javaworld.com/javaworld/javaqa/2002-08/01-qa-0823-appvswebserver.html

JSP is a Java technology that allows software developers to dynamically generate HTML, XML or other types of documents in response to a Web client request ( http://en.wikipedia.org/wiki/Java_Server_Pages ) hence, can be served by a webserver (tomcat).

JSF is a Java-based Web application framework that simplifies the development of user interfaces for Java EE applications. Out of the box, JSF uses JavaServer Pages for its display technology... ( http://en.wikipedia.org/wiki/Java_Server_Faces ).

That should explain it for you.

sandroid
  • 1,724
  • 12
  • 16