breadcrumb problem, how to link to other *.xhtml

UI Components for JSF
Post Reply
cororo
Posts: 16
Joined: 12 Jan 2010, 16:56
Location: Mexico

26 Oct 2010, 18:25

Good day;
I am working now with breadcrumb, when I try to link with another page doesnt work, the way I am trying is:

Code: Select all

<h:head>
        <title>Probando barra menu basica con glassfish server</title>
    </h:head>
    <h:body>
        <h:form>
            <p:breadCrumb>                
            <p:menuitem value="" />
            <p:menuitem value="Tarjeta madre"  action="Tarjtasmadre" />
            <p:menuitem value="Procesadores" url="Tarjtasmadre"/>
            <p:menuitem value="Discos duros" url="#"/>
            <p:menuitem value="Tarjetas de video" url="#"/>
        </p:breadCrumb>
        </h:form>      
    </h:body>
</html>
the "Tarjtasmadre" is a Tarjtasmadre.xhtml page I want to link, when I use this action="Tarjtasmadre" on simple commandbutton it works but not here, there is another way to link ???

Miguel V.
Thanks in advance.
Miguel V.
thanks in advance

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

26 Oct 2010, 18:33

You can use;

Code: Select all

url="/Tarjtasmadre.jsf"
Or create a navigation rule with a redirect so that you can use actions. So you have two choices post via action or get via url.

cororo
Posts: 16
Joined: 12 Jan 2010, 16:56
Location: Mexico

26 Oct 2010, 18:47

hi;
doest works when sat :

Code: Select all

url="/Procesadores"
or

Code: Select all

url="/Procesadores.jsf"
the server told me the Procesadores.jsf doest works on your webs folder. Ill try navigation rule.
Miguel V.
thanks in advance

cororo
Posts: 16
Joined: 12 Jan 2010, 16:56
Location: Mexico

27 Oct 2010, 18:46

hi;
I have added the next code and faces-config.xml

in the index.xhtml:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <p:resources />
        <title>Probando barra menu basica con glassfish server</title>
    </h:head>
    <h:body>
        <h:form>
            <p:breadCrumb>                
            <p:menuitem value="" />
            <p:menuitem value="Tarjeta madre"  action="#{sapo.damelotodo}"  />
            <p:menuitem value="Procesadores" action="case2" />
            <p:menuitem value="Discos duros" action="case3"/>
            <p:menuitem value="Tarjetas de video" action="case3"/>
        </p:breadCrumb>
        </h:form>      
    </h:body>
</html>
then on sapo class:

Code: Select all

import javax.enterprise.context.RequestScoped;
import javax.faces.*;
import javax.faces.bean.ManagedBean;
@ManagedBean (name="sapo")
@RequestScoped

public class sapo {

    private String none;

    public String getNone() {
        return none;
    }

    public void setNone(String none) {
        this.none = none;
        
    }
    public sapo() {
    }
    public String damelotodo(){

        return "case1";
    }

}

now using the faces-config.xml to now make a navigation rule without use "action="case1"

Code: Select all

<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">

<navigation-rule>
    <from-view-id>/index.xhtml</from-view-id>
    <navigation-case>
        <from-outcome>case1</from-outcome>
        <to-view-id>/Tarjtas_de_video.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>case2</from-outcome>
        <to-view-id>/Discos_duros.xhtml</to-view-id>
    </navigation-case>
    <navigation-case>
        <from-outcome>case3</from-outcome>
        <to-view-id>/Tarjtasmadre.xhtml</to-view-id>
    </navigation-case>
</navigation-rule>
    
</faces-config>
On this I was using the facesconfig.xml and just the action on taps to link and anyof them works, could you give some advice ??
Miguel V.
thanks in advance

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

28 Oct 2010, 10:42

For direct navigation with GET;

Code: Select all

url="Procesadores.jsf"
Assuming your page and target page is in same path.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 43 guests