• Post Reply Bookmark Topic Watch Topic
  • New Topic

Phase-Listener: GUI-output of different phases

 
Ulrich Vormbrock
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

for a showcase application, I want to output the different JSF life cycles when a simple input form is submitted.
Normally, we use to do it with the famous "System.out.println()" - but in my case, I want to do such output on the GUI (xhtml file) and not on the console.

Does anybody know how to do?

To be precise, my question should be split into the follwing sub-questions:
a) Phase-Listener-class: how can I refer to GUI elements (for example by ID)?
b) GUI: which HTML-Element should I use? ? Unfortunately, JSF doesn't provide the div-Elements which can be filled later with "innerHTML".

Any suggestions are wellcome!
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, your biggest problem is that the output from JSF isn't literally "GUI" in the sense of a desktop GUI such as Swing. It's HTML. And HTML isn't output gradually, it's sent as a single batch (subject to slice-and-dice for performance reasons). So the HTML isn't even produced until the JSF lifecycle is pretty well over.

If you don't like System.out.println, you can always use logging.
 
Ulrich Vormbrock
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Tim!

In the meantime, I've added - in the Phase Listener - each JSF life cycle to a list of a Managed Bean, something like this:



At the GUI-side, I iterate over the list of the PhaseListenerBean:


You can see my showcase at pro-jsf.de

All works fine - except that the last phase "After Phase: RENDER_RESPONSE(6)" is dropped!

Before Phase - RESTORE_VIEW(1)
After Phase - RESTORE_VIEW(1)
Before Phase - RENDER_RESPONSE(6)
LoginBean: isUsernameValid() - true
LoginBean: isPasswordValid() - true
After Phase - RENDER_RESPONSE(6)

I believe that the page is rendered BEFORE the last phase is added to the list - isn't it?
If this is not he reason, please let me know!

Thanks in advance!
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulrich Vormbrock wrote:I believe that the page is rendered BEFORE the last phase is added to the list - isn't it?


Yup.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!