How to initialize the sale id in print class?

Asked

Viewed 25 times

0

I would like to receive the id of venda in the print class of the page, being that it comes null, and I am using it to compare with the idvenda with the parameter created in Jasper.

html print.

      <p:commandLink  title="Imprimir" action="#{relatorioMB.emitir}" ajax="false" target="_blank" >
          <i class="fa fa-print"></i> Imprimir teste 
          <f:setPropertyActionListener target="#{vendaMB.venda}" value="#{lin}" />
     </p:commandLink>

I used <f:setPropertyActionListener target="#{vendaMB.venda}" value="#{lin}" />, but only works in vendaMB.

Impressaorelatorio.java

     private Venda venda;  parametros.put("idvenda", venda.getIdvenda());

1 answer

1


The sale variable of MB Vendamb needs to be annotated with @Viewscoped.

To capture in MB Impressaomb Launch the Vendamb.

In Impressaomb would look like this:

@Inject
private VendaMB vendaMB;

public meuMetodo(){
  this.vendaMB.getVenda().getId();
}
  • very good, just forgot to mention that I use another daughter class of impressaMB, and where is to be used the this.vendaMB.getVenda().getIdvenda();

  • and how I do when it’s another class without being BEAN?

  • could better specify your scenario?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.