JSF - how to send information to another page

Asked

Viewed 900 times

1

I have a orderList for the operator to select the customer’s name. After he selects I need to direct him to another page with the customer’s data. How do I pass on customer information that has been selected to another xhtml page? What is the reasoning for doing this?

  • The rationale is: the page that should show the client data expects a parameter with the client ID, and the page where the client is selected (its orderList) renders, for each client, a link to the detail page, passing the client ID on this link. Caught?

1 answer

1

You can use the Parameters:

In XHTML

<p:commandButton title="EDITAR" action="/pagina?faces-redirect=true">
    <f:setPropertyActionListener target="#{flash.objeto}"
    value="#{listItem}" />
</p:commandButton>

No Managedbean (Objeto)FacesContext.getCurrentInstance().getExternalContext().getFlash().get("objeto")

This way the id will not be passed via url, so if your client reloads the page it turns without the data.

Browser other questions tagged

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