Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6255797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:25:55+00:00 2026-05-24T14:25:55+00:00

I am developing a GWT web application. I have a login page with one

  • 0

I am developing a GWT web application. I have a login page with one textbox for user name, one passwordtextbox for password, and one submit button.

Now I want my login page has this feature: when a user logs in again, in the textbox for user name, he can find all previous inputs.

For the moment, I don’t have a clue how to do this. What should I look for? what kind of technique does this feature need?

An example for this feature is the login of hotmail. It can remember your previous input emails. I don’t need my application to remember the password.

It would be nice if anybody can give me an example.

Thanks in advance!

Best regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:25:56+00:00Added an answer on May 24, 2026 at 2:25 pm

    I think Cookies would do the trick. By the way, I have noticed for some reason SuggestBox does not support adding mouse or focus handlers so I have used the depreciated focusListener in my example. Proper way of doing this would be to use a FocusPanel to wrap the SuggestBox to catch the focus events.

    public class LoginExample implements EntryPoint {
    
        static long forgetMeIn = 1000 * 60 * 60 * 24 * 365 * 30; //30 years
        MultiWordSuggestOracle oracle;
        SuggestBox suggestBox;
        Button loginButton;
        Button showCookieButton;
    
        public void onModuleLoad() {
            oracle = new MultiWordSuggestOracle();
            suggestBox = new SuggestBox(oracle);
            updateSuggestBox();
            suggestBox.addFocusListener(new FocusListener() {
                @Override
                public void onLostFocus(Widget sender) {
                }               
                @Override
                public void onFocus(Widget sender) {
                    suggestBox.showSuggestionList();
                }
            });
            loginButton = new Button("Login");
            loginButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    String username = suggestBox.getValue();
                    if (username!=null && !username.equals("") && !cookieContains(username)){
                        addToCookie(username);
                        suggestBox.setValue("");
                        updateSuggestBox();
                        Window.alert("Next time I will remember " + username);
                    }
                }
            });
            showCookieButton = new Button("ShowCookie");
            showCookieButton.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    Window.alert(LoginExample.this.getUsernames().toString());
                }
            });
            RootPanel.get().add(suggestBox);
            RootPanel.get().add(loginButton);
            RootPanel.get().add(showCookieButton);
        }
    
        private boolean cookieContains(String s){
            boolean contains = false;
            String users = Cookies.getCookie("usernames");
            if (users!=null){
                for (String username : users.split(":")){
                    if (username.equals(s))
                        contains= true;
                }
            }
            return contains;
        }
        private void addToCookie(String username){
            String users = Cookies.getCookie("usernames");
            if (users!=null)
                Cookies.setCookie("usernames", users+":"+username, new Date(new Date().getTime() + forgetMeIn));
            else
                Cookies.setCookie("usernames", username, new Date(new Date().getTime() + forgetMeIn));
        }
        private List<String> getUsernames(){
            ArrayList<String> usernames = new ArrayList<String>();
            String users = Cookies.getCookie("usernames");
            if (users!=null){
                for (String username : users.split(":")){
                    usernames.add(username);
                }
            }
            return usernames;
        }
    
        private void updateSuggestBox(){
            oracle.clear();
            List<String> usernames = getUsernames();
            oracle.setDefaultSuggestionsFromText(usernames);
            for (String username : usernames){
                oracle.add(username);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some doubts, i m developing a web application in GWT using MVP
we are developing an web application using GWT 2.4, Errai 1.3.2. It is running
I am developing a web based application to replace a desktop based one. I
I am developing a web application in GWT 1.7.Now I am planning to move
I am developing a GWT web application and for a specific requirement I need
I developing a web application using GWT where i am trying to upload a
I am using the GWT for developing my web application and would like to
We are developing a web based application on glassfish V3. We have 2 application
I am developing a web application using gwt and gwtp. I can get a
I'm currently developing an application with Appengine and GWT. I have to send a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.