I’ve checked the wm_wizard_sample about navigation and found that the browser’s history is only modified when the Link’s redirect property (on the faces-config.xml navigation rule part) is set to true.
try it yourself: deploy the sample as it is, open it and click on add item. It moves to another view, but the url stays the same and the browser’s history isn’t updated. Try click the back button on your browser and you’ll see it won’t move anywhere.
Then update the faces-config.xml by changing the additem link redirect property to true. Deploy it again and do as before. On click, the add item button will take you a complete different url, but without the portlet context.
How can I redirect to another view and stay on the same portlet context?
The problem with the goto is that it doesn’t update the browser’s history and so the user cannot go back by clicking on the browser’s back button.
This was why I tried to use the technique on the samples for page navigation.
In my opinion the correct way for page navigation is the one shown on the samples but it just doesn’t work properly with portlets.
Fair enough. Trying to merge portlet standards and JSF hasn’t always been the smoothest process…
Do you have a workaround (like using extended urls and the redirect api?)
No, I don’t have a workaround. Do you have any?
Can you create a URL (using the IPortletURL apis) and pass that to the redirect() api of ExternalContext?
String redirectURL = <fill>;
There are a few examples in the forums for using IPortletURL apis like this: http://tech.forums.softwareag.com/viewtopic.php?t=23408&highlight=IPortletURL&sid=46d78d9d5eb6400408636d13e3e51a48 You can also search for IPortletURL and you’ll find a few.
Hope this helps.