How to pass a parameter from one .jsp page to another using JSF

120 views Asked by At

I'm creating a small project which consists in creating a small e-shop using JSF 2.1. The problem I am encountering is the following: I want to display "Hi, customerName" where customerName is the name of the customer who logged in, same with the Admin. For example an admin called "Trevor" logs in, and the app redirects you to a page where it says "Hi, Trevor".

It all goes fine the first time I do that, using:

<h:outputFormat value="Welcome, {0}.">
    <f:param value="#{adminController.admin.name}" />
 </h:outputFormat>

But then if I perform another operation, like creating and persisting a Product, if at the end I make the user click a button to return to loggedAdminHomePage.jsp, it simply displays "Welcolme, null". How can I display the Admin/User name every time he performs an operation and returns to his homepage?

0

There are 0 answers