How to send a report from a menu item in primefaces?

0

I have a menubar with several options and within one, that is, in a submenu I want to send a report, which I already have but it is shown through a button, and I do not want it to be that way, I want the choose in the submenu in automatic show the report

This is my code where I have the menu

<p:menuitem value="Reporte" url="${pageContext.request.contextPath}/jsf/reporte.xhtml?faces-redirect=true" />

and this is the code of the page that shows the report

 <h:form>

         <p:commandButton value="Generar Reporte" update="@form" actionListener="#{SctBienComponent.generateReport}" />
        <div class="column-center">
            <p:media cache="false" rendered="#{SctBienComponent.media ne null}" width="900" height="600" value="#{SctBienComponent.media}" player="pdf"/>
        </div> 

I just want to remove the button, and that in automatic without pressing anything, show the report

    
asked by Root93 21.01.2018 в 07:19
source

1 answer

0

The item menu can also execute action as the button does, in addition to the update that is very useful.

<p:menuitem value="Reporte" action="#{SctBienComponent.tuaccion}" 
update="@form"/> 

It is not very clear to me if you are going to redirect or update a component on the same page, if you are going to redirect you can do it with javascript from the menu item or also by calling javascript from the action on the server.

I hope it helps.

    
answered by 22.01.2018 в 15:41