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.
Related
If I use
context.redirectToPrevious()
It works great, but If I call an xagent with or without state between opening the document and doing a close of the document. I end up navigating to the xagent.
And If I go directly to the view behind I loose opened categories in the view.
Is there a way to block an xpage to end up in the navigation/history tree?
There are two approaches that would work.
The first is to use client-side JavaScript to open the XAgent. How you handle that will depend on whether there are values set in the browser that you are passing to sessionScope for the XAgent to use. If not, you can just use client-side JavaScript to open the relevant XAgent page. If you do need values, there are two options:
Pass them as query string parameters to the XAgent instead of storing them as sessionScope variables.
Perform a partial refresh to store the values in sessionScope and open the XAgent page via client-side JavaScript either in the onComplete() event (will trigger every time) or using view.postScript(), passing the relevant CSJS as a string (will only trigger if validation is successful).
The second is to set the previous page in the beforePageLoad event and then use that value in context.redirectToPage().
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 used the h:commandLink target="_blank" method to get the new tab, but it shows the
validation errors in the new tab. I want it to only open the new tab if the validation is passed.
So, is there a way to validate and open a new window only if validation passes?
without using javascript or jquery.
thanks
i have tried in h:commandButton but it opens in same tab
As far as I can see you can't do without javascript, because the target attribute forces the browser to open a new tab/window immediately, followed by the server request.
I have a Xpage that performs a partial refresh when a user selects a value in a combobox (onChange event). The combobox is actually a filter selector for a custom view component.
This event triggers some SSJS code and performs a partial refresh. This event breaks occasionaly, probably due to XPages session being removed.
The partial refresh is executed but the SSJS code that sets the viewScope variables is no longer executed. This results in the view showing all data without filter applied.
I added a print statement as the first line of the ssjs function. This print statement no longer executed.
I managed to reproduce this by restarting http with the page open.
Looking at the network tab in Chrome devtools shows status 200 on the partialRefreshPost. Also the partialrefresh id seems correct.
Any explanation?
This happens if the session times out, the server was restarted and/or the the application was rebuild.
If a partial refresh is then posted to the server, it is like a HTTP GET based request: The persisted view of your current XPage is "waked up again" but some the JSF lifecycle phases are skipped (3, 4, 5). SSJS code for partial refreshs is executed in the skipped phases, that's why there is no print out on your console.
[This is a very short explanation. For more information please check the XPages Master Classes Videos about the JSF lifecycle and it's details]
I am very new to JSF. I have the following requirement:
On click of a commandButton, call a backing bean method to check if there is some data present satisfying the condition.
If yes, confirm from user for overwrite.
If user says OK, call the same method of backing bean with some parameters set to tell the program to overwrite the data.
What I am doing is:
having action of the commandButton as the method name.
in the backing bean method, check if we have come with certain condition, check if the data is already present.
If yes, go back to page and ask for confirmation.
If confirmed, call the click method of the button.
The problem is, when I come back to the page, the inputFileUpload component on the page loses its value.
What can I do to achieve this? Please help.
This is fully by HTML specification and completely outside control of JSF. It's by HTML specification for security reasons not possible to (re)display the value of a HTML input file field with a value coming from the server side. Otherwise a hazard scenario as shown in this answer would be possible.
You need to redesign the form in such way that the input file field is not been updated during confirmation. You can use among others JavaScript/ajax for this: just submit the form by ajax and make sure that the input file field is not been updated on ajax response.