Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF with Facelets - Using "h:commandLink" inside header of the layout

 
Daniel Reznick
Ranch Hand
Posts: 50
Eclipse IDE Google App Engine jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I recently added facelets ability to my web app based on JSF

I have added a header.xhtml so it will be displayed on top of each page...

now i want to add a link inside the header, link which will take the user to the "Home" of the webapp, something like this:


and i added to faces-config.xml the following mapping :


but it does not work... the only way i managed to make it work is to add a mapping into faces-config.xml which will point from each page for example TestMenu.xhtml in my web app to the /MainMenu.xhtml using this <from-outcome>Home</from-outcome>
like this:


But... I don't want to use this solution cause it'll force me to add allot of mapping into the faces-config.xml file...

How can i solve this problem with minimum edit inside the faces-config.xml file?

Thanks ahead...

Daniel.

[ October 23, 2008: Message edited by: Daniel Reznick ]
[ October 23, 2008: Message edited by: Daniel Reznick ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18023
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just remove the value from the from-view-id element. The from-view-id qualifies what view the mapping applies to. If you omit it, the default is that it applies to all views.

The name of the view is based on the entire page, not specific sections within it, which is where your original problem came from.
 
Daniel Reznick
Ranch Hand
Posts: 50
Eclipse IDE Google App Engine jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

worked like charm
[ October 26, 2008: Message edited by: Daniel Reznick ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic