File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes JSF page properties on user request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF page properties on user request" Watch "JSF page properties on user request" New topic
Author

JSF page properties on user request

Dragos Crintea
Greenhorn

Joined: May 21, 2008
Posts: 9

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

Joined: Sep 21, 2008
Posts: 177
You can apply a filter to this request and set the necessary properties in the bean
Dragos Crintea
Greenhorn

Joined: May 21, 2008
Posts: 9

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

Thank you!
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
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

Joined: May 21, 2008
Posts: 9
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

Joined: Sep 21, 2008
Posts: 177
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF page properties on user request