page-refresh

Conditional rendering in JSF [duplicate]

拜拜、爱过 提交于 2019-11-29 06:33:22
This question already has an answer here: Ajax update/render does not work on a component which has rendered attribute 1 answer Hello I have this code to conditionally render components in my page: <h:commandButton action="#{Bean.method()}" value="Submit"> <f:ajax execute="something" render="one two" /> </h:commandButton> <p><h:outputFormat rendered="#{Bean.answer=='one'}" id="one" value="#{messages.one}"/></p> <p><h:outputFormat rendered="#{Bean.answer=='two'}" id="two" value="#{messages.two}"/></p> It gets the answer and renders the component but in order to see it on my page, I need to

Robust auto-refresh web page

落花浮王杯 提交于 2019-11-29 05:11:30
I have many web pages that needs to auto-refresh once a minute. Easily done with META REFRESH or a some javascript. (And yes, the whole pages needs to refresh -- LOTS of content changing). However, it needs to be as robust as possible. If the web server is momentarily down or there is a network hiccup, it can't refresh and will then get a 404 error, etc and be permanently stuck on the error page. The only option I can come up with is host the whole page in an IFRAME, and have some script on the parent page fresh the framed page. The frame should be invisible so any resizing of the window would

How to refresh another page using javascript without opening the same page in a new tab

青春壹個敷衍的年華 提交于 2019-11-28 11:32:51
Is it possible to refresh a page from another page using Javascript or JQuery without opening the same page in a new tab. JS: var newtab = window.open('http://localhost:8081/app/home'); newtab.document.location.reload(true); I tried the above, but here, it will open a new tab, with the same page, which is already opened in the browser. Please suggest a method. Nayana_Das I got the idea from a previous Question , here they used window Object Reference to reload the popup window, but for me it wont work, because, the parent window and child window runs in 2 different ports. So using the same

Retain page data on refreshing the page

ε祈祈猫儿з 提交于 2019-11-28 02:43:32
问题 I am new to angular. I am using a service which gets a list of objects and displays them on the 1st page. Then based on what object was clicked, I am setting the tab header on the next page. But while I am refreshing the page the scope of the list is lost and the tab header is throwing the exception resulting the page to not display the information. Is there any way to retain the information that which object was clicked on previous screen even when refreshing the 2nd page? 回答1: You can make

Conditional rendering in JSF [duplicate]

荒凉一梦 提交于 2019-11-28 00:07:54
问题 This question already has an answer here : Ajax update/render does not work on a component which has rendered attribute (1 answer) Closed 3 years ago . Hello I have this code to conditionally render components in my page: <h:commandButton action="#{Bean.method()}" value="Submit"> <f:ajax execute="something" render="one two" /> </h:commandButton> <p><h:outputFormat rendered="#{Bean.answer=='one'}" id="one" value="#{messages.one}"/></p> <p><h:outputFormat rendered="#{Bean.answer=='two'}" id=

retain angular variables after page refresh

好久不见. 提交于 2019-11-27 14:59:44
I'm trying to figure out a way to keep my angular variables with page refresh / across controllers. My workflow is, user logs in via facebook and gets an access token users access token will be used with every request I tried two ways, 1 - Assigning the token to a rootScope Not working 2 - By using a factory #app.js 'use strict'; angular.module('recipeapp', []) .run(['$rootScope', '$injector', 'Authenticate', function($rootScope,$injector, Authenticate){ $injector.get("$http").defaults.transformRequest = function(data, headersGetter) { $injector.get('$http').defaults.headers.common['auth-token

Force page scroll position to top at page refresh in HTML

纵饮孤独 提交于 2019-11-27 11:09:53
I am building a website which I am publishing with div s. When I refresh the page after it was scrolled to position X, then the page is loaded with the scroll position as X. How can I force the page to be scrolled to the top on page refresh? What I can think of is of some JS or jQuery run as onLoad() function of the page to SET the pages scroll to top. But I don't know how I could do that. A better option would be if there is some property or something to have the page loaded with its scroll position as default (i.e. at the top) which will be kind of like page load , instead of page refresh .

Execute function before refresh

╄→гoц情女王★ 提交于 2019-11-27 08:15:40
On my HTML page, when the user clicks / presses F5 button the page refreshes, but before it refreshes I want to execute a function or a simple alert. User can click on refresh button, press F5 or Ctrl + R . Using core JavaScript, jQuery or YUI. window.onbeforeunload = function(event) { return confirm("Confirm refresh"); }; $(window).bind('beforeunload', function(){ return '>>>>>Before You Go<<<<<<<< \n Your custom message go here'; }); Source: http://www.mkyong.com/jquery/how-to-stop-a-page-from-exit-or-unload-with-jquery/ Demo: http://www.mkyong.com/wp-content/uploads/jQuery/jQuery-stop-page

How to refresh another page using javascript without opening the same page in a new tab

放肆的年华 提交于 2019-11-27 06:17:47
问题 Is it possible to refresh a page from another page using Javascript or JQuery without opening the same page in a new tab. JS: var newtab = window.open('http://localhost:8081/app/home'); newtab.document.location.reload(true); I tried the above, but here, it will open a new tab, with the same page, which is already opened in the browser. Please suggest a method. 回答1: I got the idea from a previous Question , here they used window Object Reference to reload the popup window, but for me it wont

React | How to detect Page Refresh (F5)

瘦欲@ 提交于 2019-11-27 04:45:40
问题 I'm using React js. I need to detect page refresh . When user hits refresh icon or press F5, I need to find out the event. I tried with stackoverflow post by using javascript functions I used javascript function beforeunload still no luck. onUnload(event) { alert('page Refreshed') } componentDidMount() { window.addEventListener("beforeunload", this.onUnload) } componentWillUnmount() { window.removeEventListener("beforeunload", this.onUnload) } here I have full code on stackblitz 回答1: Place