How to enter in a Flow from p:menuitem ? ?

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
musicrizz13
Posts: 2
Joined: 01 Jun 2020, 16:16

20 Sep 2020, 21:57

I need help !

primefaces 8.0 - diamond layout 1.2 - tomEE 8 web profile

I want to enter in a Flow from a p:menuitem .

Code: Select all

<p:menuitem id="om_pp" 
                    value="Inserisci Nuovo Proprietario" 
                    icon="pi pi-user-plus"
                    outcome="proprietarioFlow"/>   <!-- FlowID -->
But , I have a error : Could not resolve NavigationCase for outcome: proprietarioFlow !!

This is my Flow definition:

Code: Select all

public class ProprietarioFlow implements Serializable {

    private static final long serialVersionUID = 1L;

    @Produces
    @FlowDefinition
    public Flow defineFlow(@FlowBuilderParameter FlowBuilder flowBuilder) {

        String vdlDocBase = "/dashboard/admin/";

        flowBuilder.id("", Costanti.FLOW_ID_PROPRIETARIO);

        flowBuilder.viewNode(Costanti.FLOW_ID_PROPRIETARIO,
                vdlDocBase.concat(Costanti.FLOW_ID_PROPRIETARIO).concat(".xhtml"))
                .markAsStartNode();

        flowBuilder.inboundParameter("pageToReturn", "#{flowBean_proprietario.pageToReturn}");

        flowBuilder.returnNode("conferma").fromOutcome("#{flowBean_proprietario.conferma}");

        flowBuilder.returnNode("annulla").fromOutcome("#{flowBean_proprietario.annulla}");

        return flowBuilder.getFlow();
    }

}
Thank you !

musicrizz13
Posts: 2
Joined: 01 Jun 2020, 16:16

21 Sep 2020, 09:59

I have found a problem .

The previous code work perfectly .

The problem is in the damned beans.xml :

Code: Select all

<beans version="1.2"   bean-discovery-mode="annotated"
       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 http://xmlns.jcp.org/xml/ns/javaee/beans_1_2.xsd">
</beans>
if bean-discovery-mode="annotated" , the @Produces method will never be called !!
the solution is or change bean-discovery-mode="annotated" with bean-discovery-mode="all"
or even better put only <beans/> in the beans.xml.

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

26 Sep 2020, 16:53

Glad to hear, thanks a lot for the update!

Best Regards,

driedpie
Posts: 1
Joined: 06 Jul 2021, 23:09

06 Jul 2021, 23:15

A menu item with an outcome generates a plain html a tag with an href to a internal page (within the domain of the application). When clicked on, that produces a get request to the specified page. The url attribute does the same btw, but can be used to refer to external page, as can be seen by investigating the source of the PrimeFaces menu showcase This functionality does not need a form since no data needs to be send to the server.

The action attribute generates an a tag as well, but it will always need to send data to the server and be able to call a method on the server. (that is how the funtion of an action in general is defined in JSF). The menu item in this case has no functional hfref (it is "#") but has an onclick that via javascript (see the source of the showcase) either does an ajax call (if specified) or full submit of the form. Since in both cases the form data needs to be send to the server a form is needed (that is how html works).ds emulator jiofilocalhtml.run
Last edited by driedpie on 07 Jul 2021, 12:16, edited 1 time in total.

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

07 Jul 2021, 09:21

Thanks for your detailed answer.

Best Regards,

Post Reply

Return to “Diamond - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests