Eclipse - How can I change a 'Project Facet' from Tomcat 6 to Tomcat 5.5?

前端 未结 7 1335
萌比男神i
萌比男神i 2021-01-31 14:01

(Eclipse 3.4, Ganymede)

I have an existing Dynamic Web Application project in Eclipse. When I created the project, I specified \'Default configuration for Apache Tomcat

相关标签:
7条回答
  • 2021-01-31 14:20

    If you are using maven you can generated the eclipse settings using the maven eclipse plugin.

    For the jst.web version the Maven eclipse pluging takes into account the dependencies of the project. If you have a servlet api dependency defined :

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>servlet-api</artifactId>
        <version>6.0.32</version>
    </dependency> 
    

    You jst.web parameter will be 6.0

    <faceted-project>
      ...
      <installed facet="jst.web" version="6.0"/>
      ...
    </faceted-project>
    
    0 讨论(0)
  • 2021-01-31 14:25

    Sorry it seems I can't post a comment without enough Rep so...

    I think it's too difficult for eclipse to degrade safely to a lower standard because it can't really know if you've used something from the newer web standard. So if it just allows you do to that it could cause your program to fail on an older version.

    You can always be backward compatible but not forwards compatible.

    0 讨论(0)
  • 2021-01-31 14:28

    You can try to uncheck the facet, apply, change the value of the facet and check. It works for me in Eclipse Helios SR1.

    So the main difference is that I do it with 'Dynamic Web Module'.

    I hope it works for you too.

    0 讨论(0)
  • 2021-01-31 14:36

    This is kind of hacking eclipse and you can get into trouble doing this but this should work:

    Open the navigator view and find that there is a .settings folder under your project expand it and then open the file: org.eclipse.wst.common.project.facet.core.xml you should see a line that says: <installed facet="jst.web" version="2.5"/> Change that to 2.4 and save.

    Just make sure that your project isn't using anything specific for 2.5 and you should be good.

    Also check your web.xml has the correct configuration:

    <web-app version="2.4" 
            xmlns="http://java.sun.com/xml/ns/j2ee" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
    0 讨论(0)
  • 2021-01-31 14:36

    if you are using Maven, then shutdown eclipse, then type >mvn eclipse:eclipse -Dwtpversion=2.0, and restart the eclipse.

    0 讨论(0)
  • 2021-01-31 14:41

    I saw the same thing, then I changed the web-app version value in the web.xml. Doing so could fix this for you.

    0 讨论(0)
提交回复
热议问题