0

I can't understand why i can use JSF in tomcat, because in this image TOMCAT don't accept JSF:

enter image description here

I'm using TOMCAT 7 and everything works fine. I added the dependency of JSF in pom.xml. What's the advantage in use TomEE if a use JSF in tomcat ?

Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92
  • That table only shows the libraries which are already provided by the server without the need to install it yourself. Related: http://stackoverflow.com/questions/7295096/what-exactly-is-java-ee and http://stackoverflow.com/tags/jsf/info – BalusC May 15 '16 at 18:43
  • So, the only diference is that i don't need add this libs to pom.xml ? TomEE already provided it to me? – Ronaldo Lanhellas May 15 '16 at 18:44
  • you probably still need the dependency during build-time, but not at deployment. Unless you want a different version than provided to you by TomEE. – Olaf Kock May 15 '16 at 19:00
  • Today i use tomcat and i would like to change to tomee because i need use EJB asynchronous. If i make this migration i need remove the jee API libs from my pom.XML ? (Jpa, jsf ..) ? – Ronaldo Lanhellas May 15 '16 at 19:04
  • Why don't you include this information right in your question? Anything that helps understanding your motivation helps in creating a better (matching) answer. Please remember this for your next questions - and note that it's not too late to edit this question to enhance it. This even matches the already accepted answer. – Olaf Kock May 16 '16 at 07:17

1 Answers1

2

You have Application Servers like Tomcat, TomEE or Websphere. Those provide a set of Java EE-Libs like JSF, Servlets, JPA, JavaMail etc.

If you are using Tomcat, you can still using JSF by simply providing the JSF-Lib in your Application yourself.

With Maven (pom.xml), you define what your App needs, like JSF or JPA, that info is needed for compiling. Even if you use a Application Server like TomEE you'll still have to declare what you need, so the compiling works.

The only difference is the Maven Dependency Scope - if you use a Java EE Application Server, you should use the Scope provided, since the Application Server has all the Libs you'll need. If you use just Tomcat, you'll need the (default) scopecompile - that will include the Libs into your artifact (*.war-file).

If you use an Application Server, make sure, the versions in your pom.xml matches the versions used in your Application server, otherwise it could happen, that you write your Program for JSF 2.2, but your Server only supports 2.0.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
hinneLinks
  • 3,673
  • 26
  • 40