JSF2.0 PrimeFaces Navigation Problem - redirect

I have a problem with navigation too right now. I have 2 dataTables, one is located within a regular facelets-page, the other one is located in a dialog.
Both have the same code:
<p:commandButton
value="Show car"
ajax="false"
action="showCar?faces-redirect=true">
<f:setPropertyActionListener value="#{car}" target="#{carBean.car}" />
</p:commandButton>
I also tried adding process="#this" without success.
The problem is, while the navigation works for the commandButton inside the facelets-page, it doesnt work for the button inside the dialog. It seems that the current page is reloaded after the click.
Replacing it with a doesn't help either.
Has anybody experienced something like this before? Could this be an issue with the dialog?
Thanks and best regards,
Robert

Forget my previous answer, I didn't read your question carefully. What might be happening is a failure in your <f:setPropertyActionListener> call. If it is (silently) failing then the error will cause JSF to automatically navigate back to the same page.
Add this to your page somewhere so you can see any helpful error FacesMessages that may be provided by the framework:
<p:messages
id="messagesForDebugging"
showDetail="true"
autoUpdate="true" />
The autoUpdate will cause it flash up messages generated by global Ajax requests.
You may also want to put a logging statement in your carBean.setCar() method to make sure that it is successfully setting the value. If it is failing then maybe you need to provide a custom converter for Car values?

Related

dotnet maui how to hide the back button on desktop?

I'm trying to hide the backbutton shown in the image on desktop, but no matter what I tried, then it keept showing up.
I have tried
<Shell.BackButtonBehavior>
<BackButtonBehavior IsVisible="False" IsEnabled="False" />
</Shell.BackButtonBehavior>
And I have tried following this SO post Why Back Button is hidden in Maui?
My navigation is done by saying await Shell.Current.GoToAsync(new ShellNavigationState(location), false);
Am I missing something?
So everything you need to know can be found here:
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/pages/navigationpage
NavigationPage.HasBackButton = true/false
Image (Proof)
https://gyazo.com/afbc744e7b6c5d1caa56960a536390c7
If this was helpful, mark this please as answer :)
This technique (the code in your question), added within the <ContentPage ... > declaration at the top of the xaml:
<Shell.BackButtonBehavior>
<BackButtonBehavior IsVisible="False" IsEnabled="False" />
</Shell.BackButtonBehavior>
seems to work when using the Shell to activate pages in C# codebehind (often in the BindingSource e.g., viewmodel):
await Shell.Current.GoToAsync($"{nameof(MyContentPage)}");
Adding this within the <ContentPage ...> declaration at the top of the xaml:
NavigationPage.HasBackButton="false"
seems to be applicable when using the push/pop within a NavigationPage:
await Navigation.PushAsync(new DetailsPage());
I don't use the Navigation.PushAsync. My app requires very specific navigation based on current data state, so a stack doesn't work for me.
I have verified setting the Shell.BackButtonBehavior (in the very code you provided) works in my case because I am activating pages via
await Shell.Current.GoToAsync
To enable/disable something you can use OnPlatform or OnIdiom
Exemple :
NavigationPage.HasBackButton="{OnIdiom Default='True', Desktop='False'}"

How to disable back button on report?

I am accessing report using URL like in example:
http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&ParentFolderUri=%2Freports%2Finteractive&reportUnit=%2Freports%2Finteractive%2FCustomersReport
I have also added custom theme to hide JasperServer decorators by folowing link: http://community.jaspersoft.com/wiki/embedding-ad-hoc-http-api
The only problem I am facing is when user click on Back button, they are exiting the report and they can see list of reports in repository. I would like to disable that behavior so that Back button just does nothing in that case. I have tried to customize the behavior as described in: http://community.jaspersoft.com/wiki/setting-default-flow-action-back-button but I can't find the proper value to replace the default action:
<end-state id="done" view="flowRedirect:searchFlow?lastMode=true" />
I have tried replacing it with
<end-state id="done" view="json:none" />
but that gave me some crazy error.
Hiding button by CSS is not a option since I need the back button to work when user is viewing sub-reports.
I did this issue for Input Control form button.
Under "...\apache-tomcat\webapps\jasperserver\WEB-INF\jsp\modules\viewReport" directory, in ViewReport.jsp file, I searched for "ICDialog" text and deleted related statements with ICDialog. Then I restarted the jasperserver by "servicerun.bat" and "servicerun.bat START" commands.
I think, this will work for back button and the others.
How about setting up the roles/users so the logged in user can only view reports allowed by that user. This would be a better solution than trying to circumvent the browser functionality. Alternatively if you have an application you are trying to embed jasper in you could use the web services to just download the report required by the user and not enable them to access the server webpage.
Simply add &decorate=no at the end of the URL.
Now the url like this {url_for_jasper_report}&decorate=no
Adding this query parameter you can hide the back button as well as the footer and header

XPages Typeahead autocomplete behavior

In XPages Mobile controls I'm having a problem with Typeahead. Actually I think the behavior changed recently - maybe with the last update of the Ext. Library but I'm not sure. Thats when we noticed the change by the way. Is has been working as desired.
Below are 2 screenshots. The first one is on a normal XPage and the second is inside Mobile Controls.
Notice how the user starts typing a "D" in the first one there's no "autocomplete". But in the second screenshot the user typed a "D" and it immediately added in the first value which in this case starts with an "O". It replaced the "D" that the user typed.
(The fact that the record with the beginning "O" is showing is working as designed, so ignore that.)
The problem is I don't want that autocomplete happening at all. I want the behavior of the first screenshot inside mobile controls. so the user can keep typing and it'll will continue to filter the list and not overwrite what the user entered.
I'm fairly certain it used to do that and I don't know what changed. The code itself did not change - that I know.
I've attempted to set autocomplete and autocorrect to "off" without any luck. I'm not sure what the difference is or if they even truly come into play.
How can I get the field to not auto-fill inside of Mobile Controls?
Any advice would be appreciated. I should note that this is privately going to be used on iPads. So it's the Mobile Safari browser.
Thanks!
Here is the basic code for this:
<xp:inputText id="inputJobCode" value="#{viewScope.selectedJob}"
styleClass="target span9">
<xp:this.attrs>
<xp:attr name="placeholder" value="Job Code" />
<xp:attr name="autocorrect" value="off" />
<xp:attr name="autocomplete" value="off" />
</xp:this.attrs>
<xp:this.dojoAttributes>
<xp:dojoAttribute name="autocorrect" value="off" />
<xp:dojoAttribute name="autocomplete" value="off" />
</xp:this.dojoAttributes>
<xp:typeAhead mode="partial" minChars="1" valueMarkup="true"
var="searchValue" valueList="#{javascript:return com.companyname.datahub.TypeAhead.jobTypeAhead(searchValue);}">
</xp:typeAhead>
<xp:eventHandler event="onchange" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var key:String = viewScope.get("selectedJob");
getComponent("inputJobCode").setValue("");
//JobData.load(key);
}]]></xp:this.action>
</xp:eventHandler>
</xp:inputText>
Here is what the output HTML is from the mobile control page:
<input type="text" id="view:_id1:checkOutFacilityID_content:_id4:inputText5"
name="view:_id1:checkOutFacilityID_content:_id4:inputText5" autocomplete="off"
class="mblTextBox target" placeholder="Job Code" autocorrect="off"
dojotype="extlib.dijit.mobile.TypeAheadCombo"
store="view__id1_checkOutFacilityID_content__id4__id9" data-dojo-
props="list:'view__id1_checkOutFacilityID_content__id4__id9', searchAttr:'value',
labelAttr:'label', labelType:'html'" spellcheck="false" tabindex="0" lang="en"
widgetid="view:_id1:checkOutFacilityID_content:_id4:inputText5" value="">
I got an answer for this from the Maire at IBM.
There was a change made in a recent Ext. Library update regarding Type Ahead. The solution for now is to use dojo to add a setting. Here's the email that IBM sent me.
Hi David,
The mobile typeAhead behavior changed in the release 901v00_04.20140226-1506
For details of the changes, see the section "Improvements to XPages TypeAhead control support" in the readme.pdf for that release.
I'm reproducing the behavior you're talking about, and I've logged an SPR:
SPR#MKEE9L7E9BLink XPages, Mobile TypeAhead, first item in the dropdown is being inserted into the edit box (should not be)
To workaround the issue:
The workaround is to write a script changing the edit box behavior,
so insert this control into your XPage, and change the name inputText1 to match your edit box's name:
<xp:panel id="panel1">
<xp:eventHandler event="onClientLoad" submit="false">
<xp:this.script><![CDATA[dijit.byId('#{id:inputText1}').autoComplete=false;/*Note autoComplete=false is different to autocomplete=off*/ ]]></xp:this.script>
</xp:eventHandler>
</xp:panel>
Regards,
Maire
I note the dojoType added to mobile - dojotype="extlib.dijit.mobile.TypeAheadCombo". It sounds like that makes it a mixture of a combo box and typeahead, which explains the functionality you're seeing.
Does it work if you add that Dojo Attribute to the non-mobile one?

Keyboard hides iOS input fields in PhoneGap Build 3.1 with an iFrame/object and JQTouch

I'm developing an app that loads a form from another website into an iFrame. The iFrame is set to 100% width and height while displayed. That website has JQTouch.
When I touch an input field in iOS 7 on the iPhone, the keyboard pops up and covers the input fields. It doesn't scroll, resize, or even let me scroll down to see the input field. If I type and then close the keyboard, nothing happens.
I've tried everything I've come across. Adding/removing height=device-height in the meta viewport tag didn't do anything. The thing that came closest to a solution was adding the preference "KeyboardShrinksView = true" in config.xml. That made it scroll (but not enough), and permanently pushes the site up about 20px or so.
I've been working on this for the last couple days with no solution in sight. Is this a bug? Is it the way JQTouch is interacting with PhoneGap Build?
UPDATE: Still no fix, but to test I took the form's page out of the iframe and set it using window.location.href="www.mywebsite.com"; They keyboard works in that situation. This is not a valid solution for me (yet), but may provide info on why it's not working.
UPDATE 2: I'm restructuring the app to use window.location.href, rather than an iframe or html object. This creates some small issues, but these are better than the keyboard not working. If anyone has an answer, I'd still like to see it.
Major Edit: I just realized the InAppBrowser plugin does NOT fix the keyboard bug alone. I did some more research, and this topic helped. I had to add "height=device-height" to every meta viewport tag. "width=device-width" should fix any problems viewing the site in mobile Safari. The final result is this:
<meta name="viewport" content="initial-scale=1, minimum-scale=1,
maximum-scale=1, user-scalable=0, height=device-height, width=device-width"/>
One of these also had a semicolon thrown in there, so be sure to check and double-check for syntax errors, as they may cause the problem.
If this doesn't work, there is another solution that you might try in place of or in addition to the meta viewport fix. It's several comments down in that topic I linked and involves some changes to the CSS. Changes to this didn't fix anything in my code, but it helped at least one person, so it's worth checking out if you still need a solution.
I tested this fix with iframe and object, and it didn't work--InAppBrowser is still necessary.
/Major Edit.
Here are some workarounds that worked for me:
Use the InAppBrowser plugin. This allows the app to interact with loadstart/loadstop/loaderror events in the loaded page within the InAppBrowser. This is the solution I suggest. However, with iOS 7, you will need to hide the status bar manually, the solution for which is here
OR Load the page using window.location.href = [website url]. If you don't need to worry about interacting with or returning to the app or linking to external sites (both of which I needed), this is the way to go. It's pretty simple, but lacks some of the functionality of the first solution.
OR Get rid of JQTouch. I wasn't able to do this, but much of it is redundant when you're building an app with PhoneGap.

seam redirect page

I use seam to manage a viewer page.
In my page I have a div (iframe) where an html page is displayed on particular conditions.
In particular I need to change the page displayed in this div deciding from serverside.
I try to explain me better:
on commandButton click the control is passed to server (using an action). This action method set some things and know what page should be loaded after (or none in some cases).
when the control come back to the caller page, the new page setted by the action method must be called (it uses the things specified by the action method).
How can I do this?
NOTE: the oncomplete tag is not usable in this context because I have many commandButton and it is called everytime I click on one of the commandButtons.
I'm not completely sure what your trying to do.
Are these pages rendered dynamically?
You can generate HTML from the serversite and just output it using a <h:outputText id="iframediv" value="#{controller.htmlparameter}" escape="false" />
An <a4j:commandButton reRender="iframediv"> could then reRender this dynamically generated page.
If the pages are defined statically you could include them like this.
<rich:panel id="iframediv">
<a4j:outputPanel rendered="{controller.page1}">
<ui:include src="page1.xhtml" />
</a4j:outputPanel>
<a4j:outputPanel rendered="{controller.page2}">
<ui:include src="page2.xhtml" />
</a4j:outputPanel>
</rich:panel>
The controller's page1 and page2 parameters should be booleans and set by the action you've called.
Solved using javascript activated only when a particular property is present over the serverside.