Reset View of webpage JSF - jsf

Is there a way to reset the view of a page in JSF?
I have a page to upload files and it keeps filling a table with the files the user wants to submit, once the user clicks on submit I want the page to be in the initial state as if it was the first time the user visited it.
Hope I explain myself correctly.

Well after searching and thinking a bit, I think I got it.
Just in the action attribute of the submit button redirect the page to the same page, this will cause to create a new view of the same page.

Related

Browser back button is not working in Blazor web-server

I want to go previous page when the user clicks on the browser back button. When I navigate another page, I can not go to the last page by using the browser back button. So, can anyone help me find a solution to this problem?
Ensure that every state that you want to show up in next/back is differentiated by a route change navigated to by NavigationManager.
If you make a page /somePage and you let the user step through several choices, and then the user navigates (using the URL bar) then hits the back button on the browser, they will go back to /somePage and not back to the choices they made.
If you make a page /somePage and each time the user makes a choice they are navigated to a new page using NavigationManager, for example /somePage/someSelection, then when they hit back they will go back to /somePage/someSelection. This requires you to load data on subpage choices on init based on optional page route parameters, but the tradeoff is having browser navigations that are part of next/back.

How to implement back previous jsf page by clicking on back button on browser

Now I encounter one issue related with browser's back button. I hope it can forward to previous page with history when user click on browser's back button. But it always forward to index.xhtml from main.xhtml. I have some operation or page embedded in main.xhtml. Does someone have some idea about that? Or you find the issue of that. Thanks.

Skip location from being pushed to the browser navigation history stack

Assuming the following scenario:
User is on product list page
Clicks a product and is redirected to the product detail page
Clicks on purchase button
POST /products/1/purchase/ is executed and redirects back to product detail page
User clicks back button
POST /products/1/purchase/ is executed again (FAIL! it should have been redirected to product list page)
How would you solve the back button problem?
Is there any response code that forces the browser to skip the location from history stack?
Assuming I can implement my own back button, how would you implement it?
Manually tracking the history, client-side
Manually tracking the history, server-side
Setting checkpoints and redirecting back to the checkpoint in case of existence
See:
Back button re-submit form data ($_POST)

Liferay: how to prevent landing pages (login and logout) from being shown in the menu?

I'm trying to find a clean way so that the login and logout pages for my liferay portal aren't shown in my menu. For the login page I guess I could move the user to the private pages section but I have no clue how I can make the logout landing page not visible. And preferably the logout page would only be navigable to when you're effectively logged out so users can't accidentally go to it when they've got the url cached in their browser.
Any input would be appreciated.
Regarding hiding the landing pages: Just create them and check "hidden" in "Manage Page" for that page. This will make the page accessible according to the permissions, but hide it in the navigation - e.g. if you know the page's name, you can go there - just as you requested.
If you display the currently logged in user on the logout landing page (e.g. through the "Sign In" portlet, you don't need to display a message like "you've been logged out", but display the current state of the user's session.
Of course you're free to not use the Sign-In opportunity on that page, in this case you'll have to display the current session state in a different portlet. It could be as simple as a templated WebContent portlet, accessing the currently logged in user.
Edit: If you set default.logout.page.path=/web/guest/logout and auth.forward.by.last.path=true but you're still not redirected on logout, chances are that changes made through the UI override your portal-ext.properties. If you've edited "Settings" in ControlPanel, this is most likely the case. You can set these values there, on the first page in settings.
As noted in your comment: You cannot make the first page hidden. This shouldn't be a problem: Just make any other page hidden. Even if you don't have more public content than this, you can have at least a public page stating that you need to login. Make this the first, so the logout page can be either a child page of this or a new toplevel page - but most importantly: It can be hidden.

Reset an iframe before navigation

I have a parent page and an iframe. When the user clicks on a link on the parent, it loads up in iframe. But the content in iframe doesn't change immediately when you click the link. The old content remains for few seconds until a network request is initiated, and then DOM is wiped up and repopulated with the new content.
What I need is, as soon as the user clicks the link, DOM is wiped off and then content is loaded. I don't want the user to see the old page even for few seconds after the link is clicked.
This problem is solved in a hackyway
iframeObj.contentWindow.document.write('')

Resources