开发者

How to configure Maven pom for Tomcat 7 with JSF 2.0 and EL 2.2?

开发者 https://www.devze.com 2023-04-13 08:42 出处:网络
i want to use EL 2.2 for JSF 2 application and tomcat 7 is provided with EL 2.2 and i am confused about the following:

i want to use EL 2.2 for JSF 2 application and tomcat 7 is provided with EL 2.2 and i am confused about the following:

1- Should i provide the servlet-api, jsp-api and the EL in my pom file (using maven) as provided or don't include them at all in the pom file, since they are provided by container, what's the difference ?

<dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <version>3.0</version>
          <scope>provided</scope>
         </dependency>


        <dependency>
          <groupId>javax.servlet.jsp</groupId>
          <artifactId>jsp-api</artifactId>
          <version>2.2</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
         <groupId>javax.el</groupId>
         <artifactId>el-api</artifactId>
         <version>2.2</version>
      开发者_运维技巧   <scope>provided</scope>
       </dependency>

2- are they any required libraries to be added to pom file to be able to use EL 2.2 ?

3- Is there's any additional configuration needed in web.xml as in this article:

http://code2inspire.wordpress.com/2010/11/05/how-to-enable-el-2-2-on-tomcat-6/

please advise.


  1. One does not need to include in the pom.xml file as tomcat already has it. But in my experience, the needs arise to include the servlet-api dependency in the pom when i try to do some servlet programming. And like you said, define the scope as provided since it's already in the tomcat, and you dont want the servlet-api jar from pom to be included when building the war. My 2 cents is not to include the dependency as long as it's running, and include when the needs arise, and then document in the pom.xml the reason it's included.

  2. I dont think you need to declare any other dependencies, as long as your container has the implementation already. I assume tomcat 7 does, since i'm using it also, and i dont declare anything else in pom dependency in order to make use of EL 2.x

  3. Never tried it since im using t7, but crosschecking with the core jsf 3rd edition book, yeah, that'd work

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号