Reputation: 16656
I would like to know how to show to my user at the top of the page, a history of his navigation. Like this:
home > register > product
And how to implement a back and a forward button in JSF. I read some topics but none of them really explain how to implement these functions. I don't want to use some framework for this, I think this is a simple thing to do, which is not necessary to use framework.
I think it's not a good idea do something with <h:link />
entirely, I'm gonna give you guys an example:
User entering at system:
home > register
the user register himself
home > login > register
(there's a link where he/she can register another user)
the correct history would be :
home > login > register
And not
home > register
Upvotes: 0
Views: 2235
Reputation: 19284
If you have each page as its own .xhtml page, then you can just hard code the breadcrumbs. If you want the back button to work well, then in all of your links/buttons you need to add ?faces-redirect=true
to your links.
Example
<h:commandLink value="Test" action="blah.xhtml?faces-redirect=true" />
Upvotes: 0
Reputation: 85779
What part of the second answer in your link didn't you understand? Using a LinkedList (a Stack
implemented by LinkedList
or a Deque
implemented by ArrayDeque
will do the work) and controlling yourself the push and pop operations must not be hard, also create a section in your page to have these links i.e. implemented by <ui:repeat>
.
Anyway, PrimeFaces has solved part of this job with the breadcumb component, even if you don't want to use a third party library for this job, you can give a look at the sources and see how PrimeFaces guys have done this job.
Upvotes: 2