Hey all,
I'd like to learn the best (or more common) way to handle conditional navigation and thus what is displayed "next". In my case, the first time a user registers, I keep a flag of the last step they were on. For example, after they activate their account, the status may be set to 1. If they are at step 1, I want to show some text and a form for them to enter some data. If they completed that, when they log in (or upon completing it, the next step) is to show another form. It's wizard like, but they may also come back to any of these specific forms at a later time to add more to them, change them, etc.
My first thought was to have the initial page (/loggedin/index.xhtml) use the rendered="" attribute in a h:panelGroup or something, such that if they were step 1, one specific panel group (and children) would be rendered, the others would not due to the rendered="" conditionals being false. If they were on step 2, a different panel is rendered. Going from step 1 to step 2 could be a post back or a redirect to the same page but with the update state causing the next panel to show up.
The other option, the one that I think makes more sense, is in the login bean method, or at any step really, returning a navigation
string configured in faces-config, that causes a redirect to a specific page, such that each of the panels in the above scenario would be their own pages.
The problem I am facing though, is in some cases, some of these panels in the first scenario my need to be on one page, later on during editing, but initially as part of a "setup" wizard I want them to be individual. Therefore, I am thinking what I really need is composite components that can be reused in different views... but then, should the setup "wizard" still use individual pages where each page uses the component, or would it make more sense to use a single page with panels that show/hide depending on a condition?