Breadcrumb navigation, doesn't execute command.

UI Components for JSF
Post Reply
kilian
Posts: 1
Joined: 25 Nov 2022, 12:40

25 Nov 2022, 12:52

Hey there,
I am currently trying to implement a programatically loaded breadcrumb navigation. I set the model with the method:

Code: Select all

public void setModel(List<CategoryDTO> categories) {
        model.getElements().clear();
        model.getElements().add(getBasicCategory());
        for (int i = categories.size() - 1; i >= 0; i--) {
            CategoryDTO currentCategory = categories.get(i);
            DefaultMenuItem item = DefaultMenuItem.builder()
                                                  .value(currentCategory)
                                                  .command("#{breadCrumbBean.redirect}")
                                                  .ajax(false)
                                                  .build();
            model.getElements().add(item);
        }
}
        
All categories get shown perfectly fine. My problem is, the redirect method is not getting called and I have no idea why.

Code: Select all

public String redirect() {
        System.out.println("Why do u not get called??!?!?");
        return "";
    }
    
My breadCrumbBean is application scoped and named, I use primefaces 12.0.0 and my xhtml implementation of the breadcrumb looks like this:

Code: Select all

<p:panel id="breadcrumb">
                <p:breadCrumb model="#{breadCrumbBean.model}">
                </p:breadCrumb>

            </p:panel>
Another question would be, if it is possible to determine which breadcrumb got called whithin the redirect() methode, because I need to perfrom actions depending on this information, if not is there any other solution given by primefaces to implement a feature like this?

Thanks for taking your time.
Kilian

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

30 Nov 2022, 16:26

If you put together a PrimeFaces Test reproducer it would be easier for us to debug: https://github.com/primefaces/primefaces-test
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests