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 886979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:09:25+00:00 2026-05-15T13:09:25+00:00

I’m currently building a GWT login screen and I managed to get a basic

  • 0

I’m currently building a GWT login screen and I managed to get a basic version of the login structure working.

I created the following pieces:

  • An entry point class (actually it was given).
  • A main application screen composite.
  • A login-screen composite.

I have the following logic in my entry point method:

MyApplication mainWindow = null;
public void onModuleLoad() {
    LoginScreen loginScreen = new LoginScreen() {
        @Override
        public String onLogin(String username, String password) {
            boolean passwordWasOk = rpcCheckUsernamePassword(username,password); // mechanism not important for this question
            if (passwordWasOk) {
                RootPanel.get().remove(0);
                mainWindow = new MyApplication();
                // Using root layout panel as main window is a layout type composite
                RootLayoutPanel.get().add(mainWindow);
                return null;
            } else {
                return "password was incorrect";
            }
        }
    };
    RootPanel.get().add(loginScreen);
}

So, I created a method in the LoginScreen composite that is called when the user clicks the ‘Sign-In’ button. If the onLogin method fails its validation of the username and password, then a narrative can be returned to the login composite so that it can update the user. The login screen will stay on the screen until the user uses a correct username/password combination.

My question is, is this the correct way to use composites? Where should my login logic ideally reside. Is a better alternative to inject some sort of login handler object in the constructor of the composite or via a setter or is the method I used quite normal?

As I’m planning to write quite a lot of code, I want to get the coding style correct from the outset.

Any feedback is greatly appreciated.

Thanks,

  • 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-15T13:09:25+00:00Added an answer on May 15, 2026 at 1:09 pm

    For complex projects you’d want to use the Model-View-Presenter (MVP) design pattern. It allows you to separate the rendering logic (views) from the business logic. To get you started, the official documentation has two articles about it plus there’s that presentation by Ray Ryan that started the whole GWT + MVP = <3 haze 🙂 After that I’d recommend browsing through MVP related questions on SO and GWT’s Google Group.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 470k
  • Answers 470k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The feature was disabled as it says here: link text… May 16, 2026 at 2:53 am
  • Editorial Team
    Editorial Team added an answer I don't know about using MySQL with the default SQL… May 16, 2026 at 2:53 am
  • Editorial Team
    Editorial Team added an answer I'm not sure what you mean by standardized, but contrib… May 16, 2026 at 2:53 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.