Hi my problem is somewhat similar to the following: ajax-listener-not-working-with-inputfile
I am able to upload files using an AJAX call in my local environment and everything works as expected. However, when I deploy the war file onto Jelastic PaaS, the AJAX listener does not seem to be working.
I've tried updating to JSF2.2 on Jelastic by replacing the jar under glassfish\modules and restarting the server, as suggested here: JSF-working-properly-AJAX-file
But this does not seem to have fixed the problem.
I've even created a very simple test similar to the one used in the first link and I am still having no luck.
xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JSF Test</title>
</h:head>
<h:body>
<h:form>
<h:commandButton id="btnTest" value="Command Button">
<f:ajax listener="#{submitFormBean.uploadTest()}"/> --> This works.
</h:commandButton>
</h:form>
<h:form>
<h:commandLink id="lnkTest" value="Command Link">
<f:ajax listener="#{submitFormBean.uploadTest()}"/> --> This works.
</h:commandLink>
</h:form>
<h:form enctype="multipart/form-data">
<h:inputFile id="fileTest">
<f:ajax listener="#{submitFormBean.uploadTest()}"/> --> This input file using Ajax call doesn't work
</h:inputFile>
</h:form>
</h:body>
</html>
bean
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
@ViewScoped
@ManagedBean(name = "submitFormBean")
public class SubmitFormBean{
public SubmitFormBean() {
}
public void uploadTest(){
System.out.println("Test");
}
}
Been stuck on this for a couple of days now so any help would be greatly appreciated. As mentioned, this works fine on my local development environment, but fails when deployed onto Jelastic's Glassfish4.