• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF page properties on user request

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
We can walk to school together. And we can both read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic