I’m working in a jsf2 application and I have a problem with the page name displayed in the address bar. When I navigate to an other page I have in address bar the name of the previous page.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s because you’re using POST instead of GET for page-to-page navigation and JSF defaults to submitting to the very same view with you’re using
<h:form>. Using POST for page-to-page navigation is in any case a very poor approach. It’s not only not user friendly (it’s not bookmarkable and confusing), but it’s also not SEO friendly (searchbots don’t follow<form>actions).To solve this problem, you must stop using
<h:commandLink>for page-to-page navigation. Use<h:link>instead.This will just render a
Which is perfectly bookmarkable, user friendly and SEO friendly.
When you’re navigating to a different page as result of a real POST form submit, I’d also replace that by returning
nullorvoidand just render the result/messages conditionally in the very same view. Or if the result is supposed to be bookmarkable (e.g. search results), you should use normal links or plain<form>instead of<h:form>and use<f:viewParam>in target view.See also: