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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:52:43+00:00 2026-06-10T16:52:43+00:00

I want to call method from different class for navigation of pages. So I’m

  • 0

I want to call method from different class for navigation of pages.

So I’m passing “UserID” & “Password” for authentication and after that it will navigate to next page.

My Code:

public class Test2 extends Composite {

HelloUIBinder hb;

AnimationHelper animationHelper;
TestPage tp;

String strEmail, strPass;

private static Test2UiBinder uiBinder = GWT.create(Test2UiBinder.class);

interface Test2UiBinder extends UiBinder<Widget, Test2> {
}

@UiField TextBox txtEmail;
@UiField PasswordTextBox txtPass;
@UiField Button btnLogin;

public Test2() {
    initWidget(uiBinder.createAndBindUi(this));

    btnLogin.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub

            strEmail = txtEmail.getText().toString();
            strPass = txtPass.getText().toString();

            Window.alert(strEmail);
            Window.alert(strPass);

            GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {

                @Override
                public void onUncaughtException(Throwable e) {
                    // TODO Auto-generated method stub
                    Throwable un = unwrap(e);

                    Window.alert(un.toString());
                }
            });

            hb.onLogin(strEmail, strPass);
        }
    });
}

public Throwable unwrap(Throwable e)
{
    if(e instanceof UmbrellaException)
    {
        UmbrellaException ue = (UmbrellaException) e;
        if(ue.getCauses().size() == 1)
        {
            return unwrap(ue.getCauses().iterator().next());
        }
    }
    return e;
}
}

By this code, I want to call onLogin() method of HelloUIBinder class by passing two parameters.

Code for onLogin :

public void onLogin(String email, String pass)
{
    Window.alert(email);
    Window.alert(pass);

    if(email == "abc@yahoo.com" && pass == "abc123")
    {
        RootPanel.get().clear();

        tp = new TestPage();
        RootPanel.get().add(tp);

        animationHelper.goTo(tp, Animation.SLIDE);
    }
    else
    {
        Window.alert("Authentication Failed");
    }
}

But, while running application I’m getting Error Message:

"com.google.gwt.core.client.JavaScriptException: (TypeError): 'null' is not an object"

So what’s an issue regarding this error ?

Please tell me any solution as soon as possible.

Thanks in advance.

  • 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-06-10T16:52:44+00:00Added an answer on June 10, 2026 at 4:52 pm

    Essentially we have a NullPointerException. The only thing that can be null in onLogin seems to be animationHelper so far and, you didn’t post any code to initialize it. However, things would be more relyable having a stacktrace. You should really change your code to deliver the trace. If you need more information you should

    • Post the stacktrace
    • Post the code used to initialize animationHelper
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call outer class' method getContentPane() from inner Action class. I don't
I want to call a redefined private method from an abstract parent class. I
I have a method that I want to call from two different places on
i want to call a apex method from a custom Button I realise we
I'm trying to call method from .jar But when I want to declare array
I want to call a method say success(message) of javascript from android activity. I
I want to call a method of my class inside a lambda expression: void
I want to call a Servlet which exists in a different war from my
I've a ViewController where I call a method from another class (TCP class), where
I am designing a loosely-coupled structure. I want to call classes from different assemblies/namespaces

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.