Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF: Tracking user views

 
Michael Sullivan
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First off, let me apologize for my ignorance.

I'm working on a new project that utilizes Websphere portal, and JSF. The goal is to track user page views to a DB for later reporting purposes. I was toying with using a response filter, and trying to save the JSF view name to the DB. However, I'm unsure if this is even feasible.

For this example, you can assume a basic JSF environment minus the portal, if that makes things less complicated. If websphere portal has something that might help, I'm all ears.

And of course, any comments are appreciated. Thanks!
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Filters would be a good "JSF independant" idea.

Another recommendation would be using JSF's Phase Listeners.
When you make a request for a JSF page, certain life cycle steps are executed on server. You can configure Phase Listener to listen some or all of the phases of JSF Life cycle and track the activity.
 
Michael Sullivan
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Varun,

Good suggestion, but I'm having trouble finding information on JSF's Phase Listeners. Do you have a link to somewhere I might learn a bit more?

Thanks,

Michael
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you won't get anything more than 1 page on PhaseListener as it's n simple concept. Try out links mentioned in this page
http://www.coderanch.com/t/210534/JSF/java/Quickie-core-dump

Else,
Create this file

And put this code in your faces-config.xml


You would get everything looking at the console. All the best.
 
Michael Sullivan
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Varun,

Sorry for the long delay in thanking you for your code sample.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic