navigation does not work

UI Components for JSF
Post Reply
finkmans
Posts: 23
Joined: 26 Dec 2013, 23:58

02 Feb 2015, 15:59

Hello.

I have copied the exmaple of the primefaces showcases http://www.primefaces.org/showcase/mobi ... nl309kocjq to a local jsf web application and the navigation does not work properly. The showcase code is

Code: Select all

<!DOCTYPE html>
<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 id="first">
            <pm:header title="Page 1"></pm:header>
             
            <pm:content>
                <h:form>
                    <p:commandButton value="Ajax Action" action="#{navigationView.gotoSecond}"/>
                    <p:button outcome="pm:second" value="Go Button" />
                    <p:link outcome="pm:second" value="Go Link" />
                    <p:button outcome="/index" value="Same Domain" />
                    <p:button href="http://www.primefaces.org" value="External Domain" />
                </h:form>
            </pm:content>
        </pm:page>
 
        <pm:page id="second">
            <pm:header title="Page 2"></pm:header>
             
            <pm:content>
                <p>Page 2 content.</p>
                <p:button outcome="pm:first" value="Go Back" />
            </pm:content>
        </pm:page>
 
        //more pages
 
    </h:body>
     
</html>

the navigation with the command button does not work. The navigation with the button and outcome attribute works. What do i have to do that the first navigation works?
PrimeFaces version: 5.0
JSF implementation name/version: Mojarra 2.2
Server name/version: Apache Tomcat 7.0.41.0

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

02 Feb 2015, 20:23

I searched this PrimeFaces Mobile forum for

navigation

and found

[Resolved] Navigation/Render error + commandButton

and

Multi page transitions
MarkusSchulte wrote:(yes, I added faces-config.xml -> application -> navigation-handler -> org.primefaces.mobile.application.MobileNavigationHandler)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

finkmans
Posts: 23
Joined: 26 Dec 2013, 23:58

03 Feb 2015, 12:35

Thanks, that helped. I created a faces-config.xml file in my web-inf folder with following content:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<faces-config
     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/web-facesconfig_2_2.xsd"
    version="2.2">
   <application>
		<navigation-handler>
			org.primefaces.mobile.application.MobileNavigationHandler
		</navigation-handler>
	</application>
   
</faces-config>
Now it works.
PrimeFaces version: 5.0
JSF implementation name/version: Mojarra 2.2
Server name/version: Apache Tomcat 7.0.41.0

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

03 Feb 2015, 15:44

You're welcome. It is a good practice to read as many forum topics as possible (daily), because there is a plethora of lessons learned (discussed/mentioned) here, and it is a knowledge base as well here. That is what I learned to do (to avoid asking questions that were never answered years ago).
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

03 Feb 2015, 20:31

It is good practice to start with the DOCUMENTATION. Since this is in there

finkmans
Posts: 23
Joined: 26 Dec 2013, 23:58

04 Feb 2015, 11:47

I tried a search here over the search function and manually through the mobile forum part, but did not find an answer. My search was for "commandbutton action". Before searching for many hours i put a question here. Okay, looking to the manual before is a god practice.
PrimeFaces version: 5.0
JSF implementation name/version: Mojarra 2.2
Server name/version: Apache Tomcat 7.0.41.0

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

04 Feb 2015, 13:30

;)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 27 guests