I have a xpages that is not rendered and in the event BeforeRenderResponse generates a pdf that is displayed on the screen as output, through a call to java bean, which builds a table in HTML and converts it to PDF which is returned to the screen through an outputstream. Since processing takes a while, I'd like to show a message to the user to wait until the file is ready to be displayed. You can do this. I have tried to do both as a text message and an animated gif, both in javascript in the event mentioned above and in java bean, without success. Could someone point me a solution.
Instead of downloading the PDF with a Full Request you could use an Ajax Download.
Here is an example: http://usefulangle.com/post/68/javascript-ajax-download-file
Related
I have a form with action attribute and within: input text and submit. When the user presses submit, the information they provided will be used to send a text message using Twilio. My question is how do I do this without reloading the page or going to another a page? Instead, I would rather have a cool small animation that displays whether it sent successfully or not, with the page remaining the same.
Thank you for your help. Much appreciated!
I basically did what zeronone said with listener on submit event, but instead wrote "return false;" preventing the page reload. I then included ajax, and the rest of the code remained basically the same.
I want to stress test my jsf application (using Primefaces) with Jmeter and i'm facing a strange (yet expected) problem.
The jmeter setup i'm using is good and working and it's using a Regular Expression Extractor to get the view state, a HTTP URL Re-writing Modifier for the JSESSIONID, a HTTP Cookie Manager and a Recording Controller.
The recorded scenario i want to use is going to a page with some Primefaces dynamic tabviews and inside that tabs there are PF command buttons that are used to save data.
Now the problem is this: when i replace the recorded ViewState with the variable holding the one extracted by the regular expression the page with the tabviews fail to navigate to other tabs (and can't render the save button) so the page can't simulate saving.
What i figured out is that when you change tabs in dynamic tabview, Primefaces do a ajax request with a new viewstate and subsequent POST requests must use this viewstate to understand the changed tab.
Is there anyone else that solved this problem somehow?
Thanks in advanced!
Before you send a request I get the first screen with a GET method, keep the id with regular expression. Then I'll send the request. For each new screen that opens has to resave the viewState overwriting the previous one.
[simple contoller]
[html request]open view e save viewState(method GET)
[regular expression extractor] extract ${myViewState}
[html request]your request sending ${myViewState}
.
[html request]OTHER open view e save viewState(method GET)
[regular expression extractor] extract ${myViewState}
[html request]your OTHER request sending ${myViewState}
...for each new screen that opens has to resave the viewState overwriting the previous one.
I am working in C#.Net and Framework 4.0. I am having a aspx and ascx pages. In my ascx, i am generating a XML and binding that XML value to Treeview. These are done in code behind. i am calling this ascx in my aspx page.
My issue is, i am having large volume of XML Data. Because of this, the performance of the page is very slow. I tried with enableviewstate and viewstatemode. But nothing works for me.
Still the viewstate is holding large volume of XML Data. I dont want this XML Data to be in viewstate.
How to fix this.
Atlast, i had done with a temporary fix..Cleared the controls viewstate value in JQuery..This process had be done in submit button onclientclick.
$('#ctl00_ContentPlaceHolder1_TreeView').empty();
And, out side the postback in pageload, i had again generated the XML value
I'm writing a chrome extension and have a question.
My extension has some .html page in it, let it be 'popup.html'. I inject a content script into some page and this script opens a 'popup.html' in a new tab with something like 'var p = window.open(chrome.extension.getURL('/popup.html'), "popup")', which works perfectly. Next, I need to pass some data to this window and I can't figure how to do it in a simple way.
For some reason I can't call child window's function from a content script with
var p = window.open(chrome.extension.getURL('/popup.html'), "popup");
p.foo(data);
In the console I see Uncaught TypeError: Cannot call method 'foo' of undefined message.
I can't pass data in a query string, because the data is simply too big.
Is there an elegant and simple way to pass data to such kind of window? I thought about messaging, but how do I effectively get tab ID of a newly opened window w/out using a background page?
Thanks a lot in advance.
UPD:
I tried to inverse the logic and get a data from parent window with 'window.opener.foo()' but in a newly opened tab window.opener returns null.
Ok, I found two solutions to my problem.
1) Add a background page, which opens a popup with chrome.tabs.create(). Then send a message from a content script to a background page, which re-sends it to a corresponding tab via chrome.tabs.sendMessage(). It looks a little ugly, but works.
2) A better one, w/out background page. Extension (popup) page creates a listener for long-lived connection. Then content script sends a message to this connection. A problem here is that a listener is not created right after the page is opened, so there should be a mechanism for a content script to wait until popup is loaded. It can be a simple setTimeout or a notification from popup via same long-lived connection.
If anyone has a better solution I'd gladly check it out as well.
I'm creating an extension for a site so that when a user types :) it changes to a graphical emotion. It all works fine when I refresh the page.
The problem is, when a user on the site types a message it's done using ajax, so there is no page load. I need a way to reload the content script, or to change the ASCII emotion to an image without reloading the page.
Is this possible?
You can listen for keyup events on the textarea or form submits if you only want to change the emotion at the end. jQuery().on() should let you do this. For example $('#textarea').on('keyup', changeEmot) or $('#form').on('submit', changeEmot). You may have to play around with the selectors and the events you get the gist.