I am new to Java Web Development and I came across a problem. I need to implement a system with JSF. The problem: I need to create a menu that has the elements from my database. I see everywhere how to develop hello world applications with only 2 pages but these don't help me to develop that menu. I am planning to use PrimeFaces 5 along with JSF 2.2 . Any help will be appreciated.
EDIT: I guess it was not understandable so I am explaining it more clearly.
I need to implement a dynamic menu which retrieves it's data from a database with a query that has WHERE clause. For example, I am trying to get Categories from a database with user_id = something. I can't use dataTable of primefaces directly.
In another aspect, I have problems with using managed beans. I couldn't quite understand where and when should I retrieve the data from database.
Normally, I use JSP and I put necessary queries just before where I use them. However, in JSF I couldn't figure out when and where to use.