I need to display most of the page in the users selected locale but display a section of the page in another locale. Basically a some point in the .xhtml, I want to set a new local for that part of the page and then at a later point switch back to the users locale. I've tried the following hacks:
Nesting <f:view locale="subsectionlocale">
Resetting the session dynamically in a getter at the start of the section (I said it was a hack).
Neither of these do what I'm hoping (as might be expected). Any ideas on a proper solution or working hack?
Related
I have a carousel component, whose slide content will be the content from another page, accessed via reference component. I want to get some properties authored in the carousel to be accessible inside the referenced page. i.e. I have Page A- with a Carousel accessing PageB through reference component. I want to get proeprties from PageA in PageB. Can this be achieved?
Sure it can, you will need to lookup/query the content and find pages where PageB is included, then get the properties of those pages (there might be more than one) and merge them. It will have to be custom code though as this is not available out-of-the-box as of AEM 6.3.
The solution could be adding a query parameter or setting a request parameter. But then again, this depends on the requirement. For me, this worked!!
I have an interesting idea to implement - I would like to create kind of "history" for user made of recent pages like:
Link1 - Link2 - Link3 - Link4 - Link5
There should be (0-5) links available.
I use only one xhtml page, displaying documents. Lets name it document.xhtml.
For every document.xhtml i attach its id to display, e.g. document.xhtml?id=4.
There are links in each document that leads to another documents (hence the idea).
There is a catch. (or rather catches)
When opening a document link in new tab, current page history should be copied to new history and then work separately in new tab.
When clicking a link from "recent pages navigator", navigator should be "cut" to clicked page position.
It would be best done by not passing parameters in urls.
I cant modify document content urls, leading to another documents. These are displayed from plain HTML.
As I use Primefaces breadcrumb to display pages history. I tried to use FlashScope to pass parameters between pages but only using postconstruct annotation. Simmilar i tried to store breadcrumb models in sessionScoped bean, but then it turned into a problem with model identification without "tabScope" identifier.
I don't ask how to resolve this on for me, but for general directions, what jsf elements should I use.
Any "how to approach this problem" will be appreciated.
=EDIT=
Thanks to #BalusC
So far #ConversationScopes seems good to me, but I still have a problem passing data to a new tab. Any ideas here?
I was recently developing an XPage that had an inputText control using a viewScope as the value. Below is the initial XPage name being used:
and this shows the viewScope values:
now when I switch to this Xpage:
the viewScope value for AccessNumber is not listed as expected:
So, now you would think that since the viewScope value for the AccessNumber has been removed from the viewScope map that if I return to the xpNewOrderFax.xsp page I would have to re-type my value. However, that is not what occurs. The viewScope value is listed once again as shown:
My question is whether this is an issue or by design because it was my understanding that a viewScope is available until you leave the current XPage. I have been able to get a co-worker to replicate this issue where the viewScope value disappears when leaving the current XPage and re-appearing when returning to the XPage. In the XPages Portable Command Guide on pg 213 it sounds like this is by design, but then on pg 215 it sounds like it is an issue. There is no value set for the application or session timeout settings on the XPage properties page.
Hopefully, someone can clarify this not only for me, but the many others using this research outlet.
Update at request of Per:
This is the code for the inputText control and I did a search to be sure I wasn't doing a viewScope.put("AccessNumber") or a viewScope.get("AccessNumber") anywhere else.
I didn't use the browser Back button when discovering this. I am using an outline entry, code below, to navigate from one page to the other, then a tab in the OneUI layout, property settings below, to navigate back.
I think Mark's comment is likely on the right track: if you go back in the browser and continue using the older page, you'll probably pick back up on the older page instance. The viewScope is tied to a combination of the page name (e.g. "/xpNewOrderFax.xsp") and the $$viewid value (e.g. "!dsk58bqeqm!"), and so the viewScope lives on the server for a little while after the user leaves the page, since the server doesn't know if the user is going to come back to it. If you visit another page and then go back in the browser to the previous one, it could resurrect the sleeping ID-keyed instance of the page and pick back up where it was, viewScope and all.
I suppose the same could also happen if you're in an environment where the initial page load is overly cached and it doesn't even re-fetch a new instance from the server on a new GET, but that would be a network/proxy/browser problem more than something with Domino.
Is it possible to set current displayed tab programmatically in <p:wizard>?
For example, I want that for two different request to the same page which contains a wizard, to have a different tab selected.
What I am currently trying to do, is to have a wizard with many tabs, in the second tab I have a redirection to another page, so when I come back I want to come to the last step which caused the redirection.
Can you please help me ? Thank you a lot !
According to primefaces documentation there's a step attribute for p:wizard tag, which specifies the step of the wizard you're currently in.
attribute: step
default value: 0
type: String
description: Id of the current step in flow
You must bind this attribute to a value of your backing bean and maintain it during redirection and coming back. If your wizard's bean is #ViewScoped you'll loose that info during redirection step, so you have to pass it using a view param or flash scope.
My answer would most probably not meet your complete requirements, but, nonetheless, it may point you towards solution to your problem.
As far as I know, the PrimeFaces Wizard UIComponent is designed for a workflow of one page. That effectively means that inputs will be handled by a backing beans that is in a view scope.
This way, making a redirection on a certain step will clear all data inputs, because your view changes and the old one is destroyed.
Anyway, a means of setting a current tab for display is step attribute of Wizard component. So,
<p:wizard step="#{wizardBean.currentStep}" >...</p:wizard>
will force the wizard to show you step which you specified in your bean. You may be able to get it by using, for example, a view parameter, like in
<f:viewParam name="step" value="#{wizardBean.currentStep}" />
But it will make sense if lifetime of your bean is more that for a view, for example, the bean could be put in session scope.
That said, maybe it is a better idea to do login beforehand. Or, if it is absolutely necessary to do it in step 2 of your wizard, provide for a built-in login functionality in a page itself, or in a popular window?
Also, programmatically the setting you speak of can be achieved via a binding of component to your backing bean and setting the step value in the backing bean, for example, in a preRenderView event.
I am building a mobile app for iPhone using the mobile controls in the XPages Extension Library.
The first page displays a list of categories (happens to be a list of user names). When a category is selected the second page is displayed listing all documents belonging to the selected user.
The URL to open the second page includes a parameter with the user's name. The second page has a page heading control and on the "label" property I have added the following code:-
if (param.get("User") != null) {
sessionScope.put("UserName", param.get("User"));
}
return sessionScope.UserName;
I'm doing this so that I have access to the user name on subsequent pages, e.g. the third page is displayed when the user opens a document from the list on the second page.
When I test this in Chrome everything is fine. When I test in Safari I can see that the sessionScope variable is set when the second page is opened. However, when I select a document and the third page is opened the sessionScope variable is disappearing. I can't see any code that would explain this and when tested in Chrome the sessionScope variable is still there on page 3. Unsurprisingly I get the same issue when I test on an iPhone.
The problem this gives me is that, when navigating back from a document (p.3) to the list of documents for the selected user (p.2) I don't know which user was selected originally.
Anyone seen this before or have any explanation as to what might be going on?
Thanks for any suggestions.
you might want to refrain from the parameter approach unless you are sanetizing your input first, so instead of the URL write the userName directly into the scope - or even easier - bind the first field with the categories to the sessionScope. Did u try to modify your code to use a different variable name?