I have an entry point which handles
My main layout including menu, header and etc.Also it
has rootpanel.get().add (login)
at the end to show the login page (uibinder)
Login.java uses uibinder and it works perfectly using RPC with server side class and I have got a reponse from database for user authentication which has been living on Google cloud sql.
I am trying to redirect user after
Login to the home page but my problem is I can not access Root panel from Login.java.
Basically I want to change the root panel from widget and redirect the user to the appropriate page based on log in result.
Any help would be highly appreciated.
Thanks
You should be able to use RootPanel.get().clear() followed by RootPanel.get().add() from anywhere in your code (including from your Login class). Note that it is generally better to use RootLayoutPanel instead of RootPanel, and I would take Andrei's advice and take a look at activities and places.
Related
I am totally new using Chatbot and I'm creating a chatbot using the Microsoft Bot Framework. Chat window is opened in an iframe.
I want to display a link in the chat message and open the link in the parent window itself (not in a new window or new tab). Is it possible to achieve this?
Otherwise can I automatically redirect to any url in my parent window from chat window?
Your question has 2 answers:
1: Yes, it is possible to change the parent window, or top window, to another URL. (Provided the browser's security mechanism allows it: eg. both pages are hosted on the same domain and no special security restrictions have been added to the iframe)
You can do this using javascript:
window.parent.location.href = '<url to browse to>';
Or html:
Link
2: When you change the URL of the parent page (the page with the iframe), your iframe will no longer be visible, since you are redirecting to a new page.
Since you will therefore close the iframe, and thus the chat window, this might not be what you want to do. My advice would be to use a new tab for links; this not only makes for a better user experience, but will also make it so you don't have to worry about security settings in browsers changing and then breaking your application.
I am new to GWT and so my knowledge is restricted.
Right now I have created a simple Login page which will take my user to another page and then based on the choices that the user makes, it will direct it to the next page. I have created 3 individual pages but I have no clue how to link them. Can someone please help.
In GWT typically you do not create separate pages - you create separate "views". They may look like pages to an end user, but in reality the entire app works in a single HTML "host" page.
You may want to look at the Activities and Places design pattern. It takes care of navigation between different "places" within your app.
very simple example with a DeckPanel. It shows only the selected 'page' and hides the other ones
DeckPanel deckPanel = new DeckPanel();
deckPanel.add(page1);
deckPanel.add(page2);
deckPanel.add(page3);
deckPanel.showWidget(0);
//deckPanel.showWidget(1);
//deckPanel.showWidget(2);
I have followed
http://krams915.blogspot.hk/2011/01/spring-and-gwt-security-via-spring.html
to build a GWT app with spring security with custom login page.
However, How can I handle the followings things?
1) If the user is not logged in, direct the user to login page, but not showing the HTTP ERROR page.
2) after the user is logged in, direct the user to front page or previous page but not /j_spring_security_check
I have tried replacing /j_spring_security_check in the loginpage.jsp to the /XXXEntry.html?gwt.codesvr=127.0.0.1:9997. I can successfully redirect back to the GWT app, but it stills said that Authentication required.
Could anybody help? Better with code examples. Thanks a lot!!
I have found another solutions for GWT and Spring Security integration:
http://www.site.lalitbhatt.com/spring-security-gwt-integration
this article make a login.html rather that jsp. Very easy to understand and implement.
Everthing works fine now.
Updated: The link moved to http://tech.lalitbhatt.net/2014/08/spring-security-gwt-integration.html
I am trying to add google gadget into FlowPanel(or HTMLPanel), but after a host page is loaded it navigates away from my page and shows gadget in a new page, if i click browser's back button it loads host page and again navigates away to new page to show the gadget.
Here is the code:
String code="here_goes_scrip_tag_for_gadget";
flowPanel.add(new HTML(SafeHtmlUtils.fromTrustedString(code)));
What am i doing wrong, please help.
UPDATE
The above code to load script was wrong, i've modified it as following:
FlowPanel gadgetContainer = new FlowPanel();
Element script = Document.get().createScriptElement();
script.setAttribute("type", "text/javascript");
script.setAttribute("src", "http://www.gmodules.com/ig/ifr?url=http://digg.com/goog/ig.xml&up_user=&up_thumbnail=1&up_filter=0&up_num=5&up_type=popular&up_refresh=0&up_tab=0&up_offset=0&up_pagination=0&up_business=true&up_entertainment=true&up_gaming=true&up_lifestyle=true&up_offbeat=true&up_politics=true&up_science=true&up_sports=true&up_technology=true&up_world_news=true&synd=open&w=320&h=200&title=Digg&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js");
gadgetContainer.getElement().appendChild(script);
But it still doesn't work.
For solving this problem in general, check out the com.google.gwt.core.client.ScriptInjector class - it has two methods that allow you to inject scripts into the page in a cross browser way. The way you are attempting to inject the script content won't work cross browser.
Looking specifically at your gadget case, I'm guessing that the script you are loading has code in it to prevent it from being loaded into another page. Have you tried to use a plain html page that references that script tag? If the same thing happens, see if you can see where in the script file the page reassigns window.location.
Maybe this is a stupid question and I did not understand exactly how Facebook applications work but here it goes
I want to implement a small e-shop as a Facebook application and for the products to have like button. The application will be instaled on a business page.
The problem is that the link for the like post on the wall will be to the actual eshop not to the facebook application on the business page.(or is it possible to make it to the application (eg. when you click the browser goes to the business page, selects the eshop tab, opens the product)?)
So actually I need to make a eshop site with 2 templates one for outside view and one for IFrame facebook view.
Is it possible to detect (from code-behind not in javascript) If the request is from the iframe or directly from outside?
Or the solution is more simple.. create a small version of the shop for browsing products only to be viewed in facebook and a full shop for outside view and the only relation between them is that when you click the like post from the first one you go to the second one?
I think I have found a solution...
I have created 2 domains that point to the eshop
shop.domainname & facebook.shop.domainname.
And in code behind I can check the Request.Url.Host if it starts with facebook.
For the facebook app the canvas url will be with facebook.shop.domainname and the links from the like button will be for the shop.domainname.
In this way I should be able to use 2 templates for the site and detect witch one I shoul use....