Resolve JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer issues

Source: Internet
Author: User

Error 1:
**When creating a new web project in eclipse, an error will pop up in the JSP file under the project: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path. This error is because the servlet jar package has not been introduced into the project. This error can be solved by introducing the jar, if it is a maven project, you can directly import the relevant jar

    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
    </dependency>

**

Error 2:
**In the newly created maven web project using eclipse, when adding the servlet jar package, there will be some errors, which is JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer. SpringWebmvc001. This error can be changed by changing the project to servlet3.0 or higher Version to solve the problem, because the new web project created by eclipse through maven is servlet2.3 version, but when the project is modified to version 3.1, the Cannot change version of project facet Dynamic Web Module to 3.1 error occurs again, and then it is Solve the error that cannot be converted to 3.1
Solution:

Change the org.eclipse.wst.common.project.facet.core.xml in the .setting folder in the project root directory to 1.8 and change to 3.1
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="1.8"/>
  <installed facet="jst.web" version="3.1"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

Modify the web.xml file to version 3.1 (if there is no web.xml in the project, you can copy one from another project)
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    id="WebApp_ID"

    version="3.1">
  <display-name>testWeb001</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

3. Update the project, if you are using java configuration, you can delete web.xml without affecting the use

4. If there is a Dynamic Web Module 3.1 requires Java 1.7 or newer error after updating the project, you can change the jre version of the project to 1.8, and then update the project

5. If you modify jre and find that the jre version has not changed after updating the project, you can configure it in the maven configuration file at this time


  <build>
    <finalName>SpringWebmvc001</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
  </build>


Solve the problem of JavaServer Faces 2.2 requires Dynamic Web Module 2.5 or newer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.