• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF page properties on user request

 
Dragos Crintea
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all!

I am quite new to JSF. However I previously worked nicely with Struts 1.x and 2.x I have a question related on how to get some properties for say a page when user is first presented with. For example I am experiencing with a login page. I would like when I call http://localhost/jsfStart/index.xhtml to route this request through a bean that sets some of the page contents In Struts I mapped an action.

How is this done in JSF?

Thank you!

 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can apply a filter to this request and set the necessary properties in the bean
 
Dragos Crintea
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

and the big question is how this filter looks like. Can you please provide me a general example

Thank you!
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article on filters would be very useful Filters
It should get you through a basic filter for incoming requests, try some examples given in the article,
if you encounter any issues then post it here and I can help
 
Dragos Crintea
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for hint. So if I understood correct is that I can basically map my LoginCheck servlet in the web.XML
however this will mean that all my further post requests will go through this LoginCheck if I map it with <URL>/*<URL>
although the form action is another servlet?
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Filter mapping that you specify in the web.xml will decide whether to route all your requests(/*)
or requests to a specific servlet(LoginCheck). Also, you can map your filter to more than 1 servlet and you can map several filters to 1 servlet too.
Your form action can be another servlet if you do not wish to filter the requests
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic