i'm making my first primefaces mobile site and i have a strange behaviour with views
<pm:page>
<pm:view id="viewName">
<ui:include src="home.xhtml" />
</pm:view>
<pm:view id="otherView">
<ui:include src="viewWhereThereIsTheForm.xhtml" />
</pm:view>
</pm:page>
if i use a commandButton (either h: or p:) in the second view (otherView) the page will reload and the first view (viewName) will be shown, everytime even if there are required elements in the form where there's the button
examples:
<h:form>
<h:inputText value="#{upload.something}" required="true" />
<h:commandButton value="Upload" action="#{upload.upload()}" />
//or
<p:commandButton value="Send" action="#{upload.trySomething()}" />
</h:form>
i've tried some solutions, always without success:
- return "pm:viewName" in the backing bean method
- RequestContext.getCurrentInstance().execute("PrimeFaces.navigate('#viewName', {reverse : 'true'})");
- FacesContext.getCurrentInstance().getExternalContext().redirect("pageName.xhtml#viewName");
the only thing i've tried with success is
<p:commandButton value="Send" action="#{upload.tryLatLon()}" oncomplete="PrimeFaces.navigate('#viewName', {reverse : 'true'})" />
but it didn't work for h:commandButton...
how can i make this stop?!
any help will be appreciated!
(i'm using PrimeFaces 3.5, PrimeFaces Mobile 0.9.4 and JSF 2.2)