Here is a very simple jsf page:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form enctype="multipart/form-data">
Hello<br/>
<h:outputText value="#{backingBean.currentTime}" />
<br/>
<h:outputText id="contatoreID" value="#{backingBean.counter}" />
<br/>
<h:commandButton value="Add" action="#{backingBean.add}">
<f:ajax render="contatoreID"/>
</h:commandButton>
<br/>
<hr/>
<h:commandButton value="Reset Counter" action="#{backingBean.resetCounter}" />
</h:form>
</h:body>
</html>
The backing bean implementation is trivial.
It has a form with multipart/form-data and two buttons, one with ajax behavior which refresh only one component in the page and a 'standard' submit button. If the Add button is pressed then Reset Counter doesn't cause the browser to refresh or navigate to a new page.
After lots of searches on internet I found this related bug report:The combination of enctype="multipart/form-data" and ajax stops navigation in some scenarios but it is not clear to me if it is recognized as a real bug or a misconfiguration issue. I'm using latest available Mojarra release 2.2.5. I cannot seen any progress on this bug report. Can you suggest some workaround ?
Besides I recently moved a web application from Glassfish 3.1.2 to Glassfish 4.0. It worked well before while now I'm struggling with lots of problems which seem bug related, such as this on <ui:repeat>.
I'm conscious I cannot ask opinion related questions here, but I'm wondering if I'm the only person which is having a bad experience with JSF 2.2 release. Maybe I was using Jsf 2.0 in a wrong/unsafe manner...
UPDATE
I add the backing bean code
@ManagedBean
@SessionScoped
public class BackingBean {
/**
* Creates a new instance of BackingBean
*/
public BackingBean() {
}
int counter = 0;
public int getCounter() {
return counter;
}
public void setCounter(int counter) {
this.counter = counter;
}
public void add()
{
counter++;
System.out.println("add called " + counter);
}
public void azzera()
{
counter =0;
System.out.println("Azzera ");
}
public String getOra() { return new Date().toString();}
}