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.
Related
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.
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.
We are on Wicket 1.5 since 6 is not released yet. And I need to turn off redirect for one page (which does not have any meaningful forms on it).
How do I turn off redirect for one page in Wicket 1.5?
Edit:
We are on wicket 1.5 since wicketstuff is not released yet for wicket 6.
No meaningful forms means that we might have a search box there but no forms where users would have to enter valuable information. It is essentially product view page.
I mean redirect that redirects back to the same page with some id added. I'm not big expert in wicket, I've heard it is done by AJAX support to battle back button issues.
Edit2:
What I want is to remove redirect from my page even if it is stateful. Is it possible in Wicket?
If by removing the redirect you just mean deleting page version number from the URL then see another Stack Overflow question: delete version number in url .
If you also want to send some form via AJAX, there's an example of that in Wicket Examples.
I was curious how FB http://www.facebook.com/ makes the chat window intact (fixed where it is ) even if you click any link on that page behind the chat. The URL changes, page's content get changed but the Chat window remains intact. Can you put some light how can I implement that feature?
The key is that it's not using postback. There's only ever one 'page' loaded, but content, layout, URL and the like are all being updated client side via AJAX requests. It remains one persistent page as far as the browser is concerned. emusic.com recently implemented a site in a similar vein.
I am truly struggling with this - i have checked all of the other Stack overflow pages and while this may seem like a duplicate question there are NO other answers I can find anywhere besides potentially using multiple modules (even though this does not seem correct)
All i want to do is have a set of static pages making up a website for my main page, the Login page (i plan to use RequestFactory to pull back the user permissions to display stuff for the app from here - somebody suggested in another post such as this to do it from a "Non-GWT" page - that doesn't sound correct to me), and then when the user logs in successfully he gets directed to the actual app with certain things being displayed based on his current permissions.
Now, i have implemented little test projects with multiple JSPs to do redirects using Window.Location.replace("...") but then I have no idea how to actually populate that particular page with what I want to be replaced.
From just 1 GWT app is it possible to have a full web page in static HTML files (or even JSPs i don't care), a Login Page, and the actual App.
And if this is so, How do you do this?
I use RootLayoutPanel.get() to load up my main App - how does it know which RootLayoutPanel to actually use - i've spent hours fighting with this and a lot of the tutorials / answers to the questions don't provide much depth as to how to actually go about implementing anything. There is obviously something i'm just missing
I want to do something exactly like the example in the showcase: https://www.blueworkslive.com/#!gettingStarted:overview
If you use chrome and check the tags every single page on there says GWT 2.4, so it's definitely not like one answer i came across saying "don't use GWT for the login". This seems like it should be something simple that I just... am not finding or honestly am not getting from any of the examples.
This is close to the last step of my project and any help on this would be greatly appreciated.
I'm using Apache Shiro with GAE, Objectify for a database and RequestFactory - there is only one main html page and the app is simply calling getRootLayoutPanel to load the app. not sure if any of that is useful.
implementing the page isn't the issue it's just the redirecting
To login on GAE, via Google account or federated login, you need to redirect your user to login page. Since you run GWT, which usually only has one page, you have two choices:
Do the normal redirect to login page - in this case browser will go to login page and you will loose GWT app state. After login, you can be redirected back to GWT app. As said - GWT app state will be lost. This is the simple way.
Open the login page in child window or iframe. Set destination URL to a page that closes the window (actually it must install a javascript parent hook, that destination page calls). When login is done, destination page calls JS hook, which notifies parent page thet login procedure is over, closes the child window/iframe and continues. This is more complex, some login pages do not like iframes (in case of OpenID login), but it retains your GWT app state.
To answer your question:
Yes it's possible to have multiple pages in a GWT project (GWT pages/modules and static files). Of course, as you navigate from page to page, you will loose app state. GWT module is only "active" as long as page is loaded in browser.