Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343806

Summary: jst.jsf facet overrides original content appended by other facets in web.xml
Product: [WebTools] Java Server Faces Reporter: Jack Liu <ljfeng1002>
Component: JSF ToolsAssignee: jsf inbox <jsf-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: raghunathan.srinivasan
Version: 3.2.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Jack Liu CLA 2011-04-26 05:05:33 EDT
Build Identifier: 201101021000

Create Dynamic web project and check jst.jsf and other facets (maybe facetA).
If facetA was called firstly, jst.jsf is after it.
jst.jsf facet install operation will erase all the web.xml content facetA appended.

The idea way is appending the element jst.jsf needs instead of create a new web.xml document root.

The current way to work around is adding jst.jsf as a soft dependency of facetA, but it doesn't make sense.

Reproducible: Always
Comment 1 Raghunathan Srinivasan CLA 2011-04-29 18:56:47 EDT
Can you try this in two steps:
1) Create a DWP with FacetA. Don't ad the JSF facet
2) Using the project's properties page, add the JSF Facet to the project. Now verify if JSF facet overwrote the previously generated web.xml

Note: If you are creating a Servlet 3.0, JSF 2.0 project and you don't want the JSF Facet to create any entries in web.xml, starting in Indigo M7, we have a checkbox to suppress the addition of servlet and its mapping in web.xml
Comment 2 Jack Liu CLA 2011-05-02 22:24:34 EDT
It can be reproduced with the two steps:

Create a DWP with my facet with web.xml below:
<?xml version="1.0" encoding="UTF-8"?><web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <display-name>jsp</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>
<listener>
<listener-class>myframework.resource.ResourceRuntimeListener</listener-class>
</listener>
<listener>
<listener-class>myframework.environment.resolvers.ResourceRuntimeListener</listener-class>
</listener>
</web-app>

Add jst.jsf facet, previous listener was removed:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>jsp</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>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
  </context-param>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>resources.application</param-value>
  </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>