GWT default place automatically in browser history? - java

Is it normal that the default place is automatically in the browser history at the first position? When I initially call my application I have the possibility to use the back button in my browser. Then the browser jumps to my default page which is my error page. Is this the normal behavior?

The history is handled by the browser. You have no chance to change it.
Maybe you can change your application and use a dialogbox to show your errors, so no entry will be down in the browser history.

Read the gwt documentation about history.
http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsHistory.html
Look at:
History.addValueChangeHandler(new ValueChangeHandler.....
Then you need to set history tokens in each view.
With this you can change the browser back button behaviour and how you navigate in the app.

Related

Making popup in JSF

I am working on creating a pop-up in JSF for my project. The popup will be used for Country/State/City look-up.
The requirements are as follows:
It should be an overlay panel and not a new browser window
This is easier. I have multiple options
jQuery dialog
Some JSF library popup (ex. richfaces dialog)
The pop-up should be a separate page (a different JSP/XHTML) so the pop-up code won't get copied in a lot of pages
This is also easy. I could make a separate JSP and use some include tag to include this jsp where ever the pop-up is required.
The pop-up JSP should be able to have form with controls that may result in post-back events within the pop-up. Like the popup may have search functionality. So there may be an in put textbox, a button along with a datatable on the pop-up. When the search button is clicked,
some action needs to be executed to load the contents of the datatable, so the form (on the pop-up) will be submitted. This should not result in the pop-up being closed.
I am stuck up with this last requirement. If when the form (on pop-up) is submitted, the pop-up should not close, then this action should be asynchronous (AJAX). But the AJAX is not used in all the actions in my project. So If I need to solve this problem using AJAX, the AJAX script should be generic enough which won't require all the pop-up JSP's to re-write.
There might be a requirement to exchange data between the host page and the pop-up JSP.
May be this can be solved with some JS script. Am I correct ?
I need help with point# 3 and 4. In general if you are aware of any existing library to solve the problem, it would be great, but even if you could help with some directions, it would be appreciated.
Thanks in advance.

Alternative to clipboard for sharing data between a web based application and legacy desktop application

I've been pondering over this problem most the afternoon and haven't yet found the most ideal solution so thought I would see what others think..
There is a legacy Win16 application that has to be modified (with the least effort) in order to communicate with a web based application.
The idea is such that in the Win16 app, the user will want to look up a specific code, so they'll click a button which will then launch the browser and allow them to navigate a specific set of pages until they find the result they desire, then they have the option of either pressing Select or Cancel.
Pressing Select should pass back a small string back to the app (around 10 characters) and close the browser. Cancel will likewise send a Cancel message back to the app and again close the browser window.
I can't see many choices available in implementation as the Win16 app is not able to call webservices, so I'm looking at using the clipboard, however that is not without problems.
I hope there's some other alternative I haven't thought of,
As always - all advice appreciated.
Thanks,

change my home in android if my application is running!

I want to change my home in android device my requirements are like following
whenever I run my application my that time on pressing home key should be disabled
so that time on pressing home key should do nothing.
but if I close that application my home should be the previous one that is launcher
So it is possible on basis of running application my home get set
I use to change in manifest.xml file and disabling the package com.android.launcher but it won't satisfy me.
Long story short... no, you cannot do this.
There are some things you can do as workarounds that would themselves be hacky at best and basically not deliver the functionality you want. Like making your application be home replacement (launcher) itself then applying the desired functionality but even in that scenario it wouldn't do what you described you want done because you wouldn't really ever get back to the previous user defined home app (launcher) and there would be system dialogs the user would need to traverse to set your app as the home replacement (launcher).
Just so it is super clear though, you cannot override the functionality of the home button without the user confirming the action.

Java Applets vs Back Button

I noticed that if you're playing a song at http://listen.grooveshark.com/ and you hit the back button Flash is smart enough to keep on playing the music while navigating "back" inside the Flash application.
Is it possible to implement this sort of thing using Java Applets, or do Applets alway shut down when you navigate away from the page (even though the resulting page contains the same applet)?
Looks like grooveshark is being tricky with the URL fragment. They store the search after the # fragment delimiter in the URL, e.g. do a search for ween, and you get this URL
http://listen.grooveshark.com/#/search/songs/?query=ween
Then do a search for bungle and the URL changes to
http://listen.grooveshark.com/#/search/songs/?query=bungle
If you click the back button in your browser, the URL changes to the previous "ween" one, but the browser remains on the same page, because everything before the fragment identifier is the same. There's some javascript that's detecting the changed fragment and updating the UI accordingly.
You could probably do something like this with an applet, but it seems better suited to javascript. The good news is, your applet is going to be cached by the browser, so if you do switch to a different page the applet loading will happen quickly.
http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
When the user leaves the page, for
example, to go to another page, the
browser stops and destroys the applet.
The state of the applet is not
preserved. When the user returns to
the page, the browser intializes and
starts a new instance of the applet.
That being said, what you could do is save the state to the server when the applet is stopped and then restore the state from the server when it starts again. If you make it a signed applet it should be able to save the state locally.

Dynamically created DOM can't hold up in cache

Hi I am building div content with AJAX call, but when I make call to any page from loaded page, if there is any exception the content loaded from AJAX call is not there in previous page. Is there any way to stop happening that?
Ajax vs Back button
If I understand well you are pressing the browser back button.
If you don't manage the history of the browser, it will break Ajax. The browser simply goes to the last location loaded, no ajax involved. If you did 3 ajax calls/loads in the last page, back button will ignore this because it's just javascript in the page and it will go back... very back.
What you can do
There are things you can do to preserve the back semantics in your ajax app but I don't know how you do it with jquery. Maybe it has tools for that. I know something about GWT that has history managing. But it's another framework...
See the History plugin. Highly recommended for this purpose.

Categories

Resources