Richfaces 4.0.0.FINAL Skinning standard JSF tags and Html tags automatically cannot load - spring

I've enabled skinning in my web.xml but nothing seems to take effect in my richfaces 4.0.0.FINAL why? My web.xml
<?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_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<!-- Log4j configurated in spring!!!,
before any code directly calling log4j (calling through commons logging doesn't count)? Jing Xue -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j-webapp.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>1000</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myWebapp-instance-root</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<display-name>richfaces-application</display-name>
<!-- Listener para crear el Spring Container compartido por todos los
Servlets y Filters (WebApplication Context)-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:META-INF/spring/spring-master.xml
WEB-INF/spring/spring-security.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- For JSF -->
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!-- Jboss not use it bundle integrated JSF -->
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
<!-- Facelets, tell JSF to use Facelets -->
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<!-- Spring JavaServiceFaces framework ApacheMyfaces -->
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<!-- Spring Security, for all -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- RichFaces Framework -->
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinningClasses</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<!-- Servlets for JSF-->
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<!-- Servlet for Dispatcher of flows -->
<servlet>
<servlet-name>transportes</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/spring/transportes-servlet.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>transportes</servlet-name>
<url-pattern>/flows/*</url-pattern>
</servlet-mapping>
<!-- Servlet register for SpringFaces, SpringJavaScript -->
<servlet>
<servlet-name>resources</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
<!-- Page That control SpringWeb -->
<!--
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/jsp/error.jsp</location>
</error-page>
-->
<welcome-file-list>
<welcome-file>/WEB-INF/flows/inscripcion/login.xhtml</welcome-file>
</welcome-file-list>
</web-app>
and the page that i was to inject my blueSky theme. login.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/WEB-INF/flows/template/default.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich">
<ui:define name="windowTitle">
#{msgs.loginTitle}
</ui:define>
<ui:define name="heading">
<ui:include src="/WEB-INF/flows/sections/login/header.xhtml"/>
</ui:define>
<ui:define name="sidebarLeft">
<ui:include src="/WEB-INF/flows/sections/login/sidebarLeft.xhtml"/>
</ui:define>
<ui:define name="content">
<h:form>
<h:panelGrid columns="2">
#{msgs.namePrompt}
<h:inputText id="name" value="#{user.name}"/>
#{msgs.passwordPrompt}
<h:inputSecret id="password" value="#{user.password}"/>
</h:panelGrid>
<p>
<h:commandButton value="#{msgs.loginButtonText}"
action="planetarium"/>
</p>
</h:form>
</ui:define>
</ui:composition>
this is my template.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title><ui:insert name="windowTitle"/></title>
</h:head>
<h:body>
<div id="heading" >
<ui:insert name="heading">
<ui:include src="/sections/inscripcion/header.xhtml"/>
</ui:insert>
</div>
<div id="sidebarLeft" style="float:left;height : 193px; width : 101px;">
<ui:insert name="sidebarLeft">
<ui:include src="/sections/inscripcion/sidebarLeft.xhtml"/>
</ui:insert>
</div>
<div id="content" style="float:right;height : 193px; width : 689px;">
<ui:insert name="content"/>
</div>
<!-- <ui:debug/>-->
</h:body>
</html>
Why not load the blueSky skin?

Related

Primefaces Mobile p:fileupload upload method not called

I am working on a web application for mobile devices where a user can upload a file (image) on several occasions.
Since I am using the Primefaces mobile renderkit, I have to use Primefaces' simple p:fileuploadwithout ajax.
The Problem:
When I want to upload an Image I can select the file (components are rendered correctly) and then hit the "Upload" button. After I hit "Upload", the page refreshes but myBean.saveImage() is never called. myBean.fileUploadController.setFile isn't called either. I don't get any error messages in the Netbeans console and neither in Chromes JS Console.
So far I tried to use the native HTTP Servlet Upload which is supported by primefaces since version 5.0 and the old commons.fileupload way - same result.
I followed this great guide to troubleshoot p:fileuploadbut I still get the same result after doing everything suggested in the guide.
I created a fileuploadtest.xhtml page to test the upload functionality which looks like this:
<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:p="http://primefaces.org/ui"
xmlns:pm="http://primefaces.org/mobile">
<f:view renderKitId="PRIMEFACES_MOBILE" />
<h:head>
</h:head>
<h:body>
<pm:page>
<pm:header title="Title"></pm:header>
<pm:content>
<h:form enctype="multipart/form-data">
<p:fileUpload value="#{myBean.fileUploadController.file}" mode="simple"/>
<p:commandButton value="Upload" ajax="false" action="#{myBean.saveImage}"/>
</h:form>
</pm:content>
<pm:footer title="Footer"></pm:footer>
</pm:page>
</h:body>
</html>
Here is my bean and my FileUploadController class:
MyBean.java:
#Component
#Scope("session")
#Named
public class MyBean implements Serializable {
#Autowired(required = true)
private FileUploadController fileUploadController;
//Bunch of unrelated methods
public void saveImage() {
this.fileUploadController.upload();
//some more code after upload() is complete
}
//getters&setters
}
FileUploadController.java:
#Component
#Scope("session")
public class FileUploadController {
private UploadedFile file;
public boolean upload() {
if (file != null) {
//upload here
return true;
} else {
return false;
}
}
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
}
Here is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.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-app_3_0.xsd">
<description>Webflow Archetype</description>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/spring/applicationContext.xml,/WEB-INF/config/web-application-config.xml
</param-value>
</context-param>
<!-- Causes Facelets to refresh templates during development -->
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.sendPoweredByHeader</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cupertino</param-value>
</context-param>
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>Define partial state saving as true/false.</description>
<param-name>javax.faces.PARTIAL_STATE_SAVING_METHOD</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
<!-- Custom MarqueeComponent -->
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/marquee-taglib.xml</param-value>
</context-param>
<context-param>
<param-name>BootsFaces_USETHEME</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/ *</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Allows Jetty to serve Faces applications -->
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/ *</url-pattern>
</filter-mapping>
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</param-value>
</context-param>
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<session-config>
<session-timeout>180</session-timeout>
<cookie-config>
<secure>true</secure>
</cookie-config>
</session-config>
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value/>
</init-param>
<load-on-startup>2</load-on-startup>
<multipart-config>
<max-file-size>10485760</max-file-size>
<max-request-size>20971520</max-request-size>
<file-size-threshold>5242880</file-size-threshold>
</multipart-config>
</servlet>
<!-- Map all /spring requests to the Dispatcher Servlet for handling -->
<servlet>
<servlet-name>Jersey Spring Servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>at.managementpartners.icosysmobile.rest</param-value>
</init-param>
</servlet>
<!-- <servlet>
<servlet-name>GetClientHostnameServlet</servlet-name>
<servlet-class>at.managementpartners.icosysmobile.web.util.GetClientHostnameServlet</servlet-class>
</servlet> -->
<servlet>
<servlet-name>FileServlet</servlet-name>
<servlet-class>at.managementpartners.icosysmobile.web.util.FileServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/spring/ *</url-pattern>
</servlet-mapping>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<multipart-config>
<max-file-size>10485760</max-file-size>
<max-request-size>20971520</max-request-size>
<file-size-threshold>5242880</file-size-threshold>
</multipart-config>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/javax.faces.resource/ *</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/ *</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/do/ *</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<!--servlet>
<servlet-name>Primefaces Resource Servlet</servlet-name>
<servlet-class>
org.primefaces.resource.ResourceServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Primefaces Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/ *</url-pattern>
</servlet-mapping-->
<!-- Welcome files -->
<servlet-mapping>
<servlet-name>Jersey Spring Servlet</servlet-name>
<url-pattern>/rest</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Jersey Spring Servlet</servlet-name>
<url-pattern>/rest/ *</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileServlet</servlet-name>
<url-pattern>/files/ *</url-pattern>
</servlet-mapping>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<trim-directive-whitespaces>false</trim-directive-whitespaces>
</jsp-property-group>
</jsp-config>
</web-app>
I configured this web.xml to work with commons.fileupload and not with the HTTP Servlet native Upload functionality.
Please note that I had to seperate ´/*´ with a space (´/ *´) so that the rest of my code wouldn't get formatted as a comment. (If there is a smarter way to do this please don't hesitate to tell me)
My web application relies on the following technologies/libraries:
JSF 2.2.9
HTTP Servlet 3.0.1
Spring MVC
Spring Webflow
Primefaces 6.0 with <f:view renderKitId="PRIMEFACES_MOBILE" />
Omnifaces 1.5
Bootsfaces 0.8.1
Netbeans as IDE
For testing and debugging purposes I deploy the app to Jetty 8.1.5 via Netbeans.
However I tried deploying the app to a Tomcat server as well with the same result.
Please forgive the long post, I just wanted to include everything that seemed remotely useful. If you need anything else please let me know.
Thank you very much in advance.
EDIT:
It appears that my problem does not have anything to do directly with p:fileupload but rather with my p:commandButtons not invoking any action event at all, when I disable ajax. To test this, I added the ajax="false" attribute to one of my comandButtons on another page. As soon as I added it, my commandButton stopped working and it just refreshed the site but never handled the event specified in the action attribute. Does anyone have an idea why my commandbuttons stop working with ajax="false"?
Edit2
I posted a new question since I discovered that the problem is related to something slightly different

Primefaces <p:fileUpload isn't invoking the bean method

I'm trying to implement the primefaces file upload but isn't invoking the bean method, by the way I'm using spring framework and prettyfaces:
faces-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<application>
<resource-bundle>
<base-name>label</base-name>
<var>msg</var>
</resource-bundle>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
</faces-config>
web.xml file:
<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-context.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>log4j-config-location</param-name>
<param-value>WEB-INF/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>co.com.core.commons.LogContextListener</listener-class>
</listener>
<!-- ############################################# -->
<!-- # File upload # -->
<!-- ############################################# -->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>2097152</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<!-- ############################################# -->
<!-- # QUARTZ # -->
<!-- ############################################# -->
<!-- listener>
<listener-class>
org.quartz.ee.servlet.QuartzInitializerListener
</listener-class>
</listener-->
<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>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
.xhtml code:
<h:form enctype="multipart/form-data" prependId="false">
<p:fileUpload mode="simple" value="#{templateController.file}" />
<p:commandButton value="Upload" actionListener="#{templateController.upload}" ajax="false" />
</h:form>
bean method:
public void upload() {
FacesMessage msg = new FacesMessage("Success! is uploaded.");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
I tried adding the FORWARD to the filter because I'm also using pretty faces, but still not working, thanks.
Try implementing followings,
add this method to your bean,
public void handleProfileFileUpload(FileUploadEvent event) {
if (event != null) {
try {
InputStream inputStream = event.getFile().getInputstream();
// Set inputstream to your object
} catch (IOException e) {
e.printStackTrace();
}
}
}
Remove CommandButton and modify fileUpload config similar to this, fileUploadListener handle the uploading
<p:fileUpload fileUploadListener="#{<your bean>.handleProfileFileUpload}"
mode="advanced" sizeLimit="2097152"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
Well finally after a lot of readings I solved this, in my case the solution was to add a context-param (primefaces.UPLOADER) into the web.xml file (check this answer please), this file looks like this, also could be helpful to set the project stage to develop (commented in this file), this could give you some additional information related to the debug process:
<?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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-context.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>log4j-config-location</param-name>
<param-value>WEB-INF/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>co.com.core.commons.LogContextListener</listener-class>
</listener>
<!-- ############################################# -->
<!-- # File upload # -->
<!-- ############################################# -->
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>2097152</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<context-param>
<param-name>primefaces.UPLOADER</param-name>
<param-value>commons</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>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
If you are using Spring MVC, your filter mapping should point to the Spring DispatcherServlet instead of Faces Servet.
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Spring MVC Servlet</servlet-name>
</filter-mapping>

java.lang.NullPointerException at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChainContents

I have a war application (spring + jsf1.2/richfaces + hibernate) running on my was8.5 server, when i try to access http://localhost:9080/name_app/login.xhtml, I get java.lang.NullPointerException coming from the server internal source, below is the log trace of the error :
[28/01/16 09:45:06:325 WET] FFDC Exception:java.lang.NullPointerException SourceId:com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters -RE ProbeId:1123 Reporter:com.ibm.ws.webcontainer.filter.WebAppFilterManagerImpl#9afb2765
java.lang.NullPointerException
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChainContents(WebAppFilterManager.java:775)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:379)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:931)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3926)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="Auth_Super_Admin_WEBAPP" version="3.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-app_3_0.xsd">
<description>Antij Project web.xml</description>
<display-name>Antij -AuthForte-User-Admin-web</display-name>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>classic</param-value>
</context-param>
<!-- added , but doesn't affect-->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableViewStateIdRendering</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/web-context.xml</param-value>
</context-param>
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- <context-param> -->
<!-- <param-name>javax.faces.STATE_SAVING_METHOD</param-name> -->
<!-- <param-value>server</param-value> -->
<!-- </context-param> -->
<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>
<context-param>
<param-name>facelets.LIBRARIES</param-name>
<param-value>/WEB-INF/components/antij.taglib.xml</param-value>
</context-param>
<!-- -->
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
<init-param>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
</init-param>
<init-param>
<description>Set the threshold size - files below this limit are stored
in memory, files above this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
</init-param>
</filter>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</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>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<servlet-name>*.xhtml</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- listener to load spring beans -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/modules/index.xhtml</welcome-file>
</welcome-file-list>
<!--
<resource-ref>
<description>My Data Source.</description>
<res-ref-name>acs_3ds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>-->
<!-- resource ref for websphere -->
<resource-ref>
<res-ref-name>jdbc/acs_3ds_websphere_db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<persistence-unit-ref>
<persistence-unit-ref-name>persistence/authentification-forte-user-admin-entityManager-pu</persistence-unit-ref-name>
<persistence-unit-name>authentification-forte-user-admin-entityManager-pu</persistence-unit-name>
</persistence-unit-ref>
</web-app>
According to the log trace it didn't originate in own code, I think it's about some misconfiguration in web.xml , Am not sure.
How is this caused and how can I solve it?
I experienced this same bug and found a solution.
Find which filter is causing this error by removing the filters from web.xml one at a time until you don't get this error.
Then rename that filter in both <filter><filter-name> and <filter-mapping><filter-name>. Note that filter-name can be any string but that values must match. It does not need to be the same name as your filter class name only <filter-class> needs to be the same name as your class.
Now try running it and it should work. You should now be able to rename your filter to it's original name.

Facelet not being rendered

I am trying to migrate our project from RicFaces3 to Richfaces4.With the help of similar post available here, I was able to resolve all the build issues.However my login page doesn't load, when I try access the application http://localhost:8080/expense-portal/ , it shows a File Download window instead. I am copying all the config and xhtml here.Would really appreciate if someone can help.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="2.5">
<display-name>expense-portal</display-name>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml /WEB-INF/security.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
<param-value>true</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.BUILD_BEFORE_RESTORE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>com.mpro.expense.portal.ui.listener.SessionListener</listener-class>
</listener>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!--<context-param> <param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>NONE</param-value> </context-param> -->
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<filter-name>authenticationFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>authenticationFilter</param-value>
</init-param>
<init-param>
<param-name>targetFilterLifecycle</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>authenticationFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<!-- error servlet -->
<servlet>
<servlet-name>Error Servlet</servlet-name>
<servlet-class>com.mpro.expense.portal.ui.error.ErrorHandlingServlet</servlet-class>
<init-param>
<param-name>applicationName</param-name>
<param-value>Expense Portal</param-value>
</init-param>
<init-param>
<param-name>errorPage</param-name>
<param-value>/error.jsf</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Error Servlet</servlet-name>
<url-pattern>/error</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/error</location>
</error-page>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/sessionExpired.jsf</location>
</error-page>
<error-page>
<error-code>401</error-code>
<location>/login.jsf</location>
</error-page>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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"
version="2.0">
<application>
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<!-- <view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler> -->
</application>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>login.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>login.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
<converter>
<converter-for-class>java.lang.String</converter-for-class>
<converter-class>com.mpro.expense.portal.ui.util.EmptyToNullConverter</converter-class>
</converter>
</faces-config>
login.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich">
<head>
<title>Expense Portal</title>
<link href="css/stylemask.css" media="screen" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.6.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery.noConflict()
</script>
<script type="text/javascript">
//
var url = window.location.pathname;
var filename = url.substring(url.lastIndexOf('/') + 1);
if (filename.indexOf("login.jsf") == -1) {
window.location = "/expense-portal/login.jsf"
}
jQuery(document).ready(function() {
});
//
</script>
</head>
<body>
<div class="container" style="width: 480px; position:absolute; top:50%;left:50%;margin-left:-240px; margin-top:-190px;">
<div id="header">
<div id="title">
<b>Expense Portal</b>
<span><h:outputText value="#{homepageBean.environment}" /></span>
</div>
<div class="clear"></div>
</div>
<h:form id="form">
<h:messages id="resultMsg" errorClass="error-message" infoClass="info-message" />
<div class="input-row">
<div class="required">*</div>
<h:outputLabel id="usernameLabel" for="username" value="Username:" />
<h:inputText id="username" styleClass="text" maxlength="255" value="#{loginBean.username}">
<rich:beanValidator />
</h:inputText>
</div>
<div class="input-row">
<div class="required">*</div>
<h:outputLabel id="passwordLabel" for="password" value="Password: " />
<h:inputSecret id="password" styleClass="text" maxlength="50" value="#{loginBean.password}">
<rich:beanValidator />
</h:inputSecret>
</div>
<div class="input-row">
<div class="required">*</div>
<h:outputLabel id="domainLabel" for="domain" value="Domain: " />
<h:selectOneMenu styleClass="text" id="domain" value="#{loginBean.domain}">
<rich:beanValidator />
<f:selectItems value="#{userManagementBean.domainList}"/>
</h:selectOneMenu>
</div>
<div class="clear"></div>
<h:commandButton id="loginBtn" value="Login" class="submit-button" action="#{loginBean.login}" />
</h:form>
<br />
<br />
</div>
</body>
</html>

Command Button links to incorrect Path Name in a Spring Web Flow Project

I am trying to add two numbers together and display the output, but I'm having rendering problems.
I get this from the ajax log. (Spaced out for readability)
info [12:44:10.893]: Element error
<error>
<error-name>
class com.sun.faces.context.FacesFileNotFoundException
</error-name>
<error-message>
<![CDATA[/WEB-INF/WEB-INF/intro.xhtml Not Found in ExternalContext as a Resource]]>
</error-message>
</error>
I do not see where it is getting the two WEB-INF folders in the path name.
The second part of the this question is that I am not sure where calculator.sum should be called at either. This may be effecting the result or need to be in a separate question. #{calculator.sum} is the output that is called when the button is clicked.
This is the form that I am editing.
<rich:panel id="UserManagePanel" header="Welcome to test">
Enter The WebFlow
<br/>
<br/>
<br/>
<h:inputText id="additive1" value="#{calculator.a}"/>
<br/>
<h:inputText id="additive2" value="#{calculator.b}"/>
<br/>
<a4j:commandButton type="button" id="btn_add" action="#{calculator.sum}" value="Add" reRender="out" execute="#form"/>
<br/>
<a4j:outputPanel id="out">
<h:outputText value="#{calculator.sum}" rendered="true"/>
</a4j:outputPanel>
<br/>
<a4j:log/>
</rich:panel>
</h:form>
Supporting Docs:
main-flow.xml
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd">
<view-state id="Page2">
<transition on="gotoPage3" to="Page3"/>
<!-- <transition on="printDets">
<evaluate expression="userBean.printDetails()" />
</transition> -->
</view-state>
<view-state id="Page3">
<transition on="gotoSubFlow" to="Page3subflow"/>
<transition on="gotoPage5" to="Page5"/>
</view-state>
<view-state id="Page5">
</view-state>
<subflow-state id="Page3subflow" subflow="subflow1">
</subflow-state>
<end-state id="finish" />
</flow>
web.xml
<?xml version="1.0" encoding="ASCII"?>
<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_3_0.xsd" version="3.0">
<!-- The master configuration file for this Spring web application -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/web-application-config.xml
</param-value>
</context-param>
<!-- Declare Spring Security Facelets tag library
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
</context-param> -->
<!-- Enforce UTF-8 Character Encoding -->
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Enables Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>joshCustom</param-value>
</context-param>
-->
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Enables special Facelets debug output during development -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Causes Facelets to refresh templates during development -->
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<!--
Uncomment this to disable partial state saving when using Apache MyFaces 2 !!
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
-->
<!-- Loads the Spring web application context -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Map all /spring requests to the Dispatcher Servlet for handling -->
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/spring/*</url-pattern>
</servlet-mapping>
<!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Just here so the JSF implementation can initialize -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<!-- Added for JAX-WS compatibility -->
<servlet>
<servlet-name>JAX-WS Servlet</servlet-name>
<servlet-class>demo.SimpleServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>JAX-WS Servlet</servlet-name>
<url-pattern>/SimpleService</url-pattern>
</servlet-mapping>
<!-- The welcome file -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app><?xml version="1.0" encoding="ASCII"?>
<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_3_0.xsd" version="3.0">
<!-- The master configuration file for this Spring web application -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/web-application-config.xml
</param-value>
</context-param>
<!-- Declare Spring Security Facelets tag library
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
</context-param> -->
<!-- Enforce UTF-8 Character Encoding -->
<filter>
<filter-name>charEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Enables Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>joshCustom</param-value>
</context-param>
-->
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<!-- Enables special Facelets debug output during development -->
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<!-- Causes Facelets to refresh templates during development -->
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>1</param-value>
</context-param>
<!--
Uncomment this to disable partial state saving when using Apache MyFaces 2 !!
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
-->
<!-- Loads the Spring web application context -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
<servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Map all /spring requests to the Dispatcher Servlet for handling -->
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/spring/*</url-pattern>
</servlet-mapping>
<!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Just here so the JSF implementation can initialize -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<!-- Added for JAX-WS compatibility -->
<servlet>
<servlet-name>JAX-WS Servlet</servlet-name>
<servlet-class>demo.SimpleServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>JAX-WS Servlet</servlet-name>
<url-pattern>/SimpleService</url-pattern>
</servlet-mapping>
<!-- The welcome file -->
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Java class Calculator.java
package demo;
import javax.faces.bean.*;
import org.springframework.stereotype.Component;
#ManagedBean
#Component
#ViewScoped
public class Calculator implements java.io.Serializable{
private static final long serialVersionUID = -3832235132261771583L;
private int _a;
private int _b;
public int getA() { return _a; }
public void setA(int a) { _a = a; }
public int getB() { return _b; }
public void setB(int b) { _b = b; }
public int getSum()
{
return _a + _b;
}
}
Libraries I'm Using:
Using Richfaces 4.3.4
Spring Security 3.1.3
JSTL 1.2.1
Spring 3.2.0.RELEASE
Since the calculator.sum only returns the number (and doesn't do anything in the background) there is no point calling it when you click the button.
I don't know what causes the error but WEB-INF is for config files and stuff like that. If you have any (x)html pages in there move them out.
To get this to work a few things had to happen.
1) WEB-INF/ from the webmvc-config.xml under the flowlistener.
2) and had to be used to at least debug it.
3) The form must be in and tags.
4) The url must use webflow
http://localhost:8080/CLPWeb/spring/grantSearchFlow?test
rather than
http://localhost:8080/CLPWeb/spring/WEB-INF/templates/views/test.xhtml
Used url's as code to get it to validate.

Resources