I create simple project using the following environment. 1. Netbeans IDE6.9.1 (File->NewProject->Select JSF2.0 libraries)
- Tomcat 6.0.29
jars
1.Commons-beanutils-1.7.0.jar
2.commons-collections-3.2.jar
3.commons-digester-1.8.jar
4.commns-logging-1.0.4.jar
5.el-funstions.jar
6.jhighlight.jar
7.cssparser-0.9.5.jar
8.guava-r09.jar
9.sac-1.3.jar
10.richfaces-api-3.3.3.Final.jar
11.richfaces-impl-3.3.3.Final.jar
12.richfaces-ui-3.3.3Final.jar
13.jsf-facelets-1.1.15.B1.jar
14.JSF 2.0-jsf-api.jar
15.JSF2.0-jsf-impl.jar
16.JSTL 1.1-Standard.jar
17.JSTL 1.1- jstl.jar
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
<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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<!--Configuration for Richfaces-->
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!--End of the configuration part for Richfaces-->
<!--Configuration for Facelets-->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
<context-param>
<param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!--End of the configuration part for Facelets-->
<!-- The following attribute facelet -->
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
<param-value>true</param-value>
</context-param>
<!-- End of The following attribute facelet -->
</web-app>
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
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-facesconfig_2_0.xsd">
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
</application>
</faces-config>
index.xhtml file
<?xml version='1.0' encoding="UTF-8'?>
<!DOCTYPE html PUBLIC "-//W#C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich">
<h:body>
Hello Facelet
<h:outputText value="Sample output text"/>
<rich:panel>
<f:facet name="header">
<h:outputText value="Sample Panel"/>
</f:facet>
<h:outputText value="Panel content added here"/>
</rich:panel>
<h:body>
</html>
When i run my project, i got the following error. and also i don't know the above configuration and jars are correct ot not.
javax.servlet.ServletException: Illegal attempt to set ViewHandler after a response has been rendered.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.
com.sun.faces.application.ApplicationImpl.setViewHandler(ApplicationImpl.java:562)
org.ajax4jsf.event.InitPhaseListener.beforePhase(InitPhaseListener.java:92)
com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
Help me. Thanks in advance.