GWT 응용 프로그램에서 UIBinder를 사용하여 두 개의 Java 클래스를 만들었습니다. EntryPoint 클래스에 선언 된 공통 메소드의 도움으로 한 페이지를 다른 페이지로 이동하려고합니다.GWT 응용 프로그램에서 다른 클래스의 호출 메서드
하지만 UIBinder 클래스의 Button Click Event에서 EntryPoint 클래스의 메서드에 액세스 할 수 없습니다.
내 코드 : HelloUIBinder 클래스에서
HelloUIBinder hb;
@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);
hb.onLogin(strEmail, strPass);
}
});
}
, 로그인에 대한
방법 : 내가 UmbrellaException 오류 메시지를 받고있어이 방법 동안
public void onLogin(String email, String pass)
{
Window.alert(email);
Window.alert(pass);
if(email == "[email protected]" && pass == "abc123")
{
RootPanel.get().clear();
tp = new TestPage();
RootPanel.get().add(tp);
animationHelper.goTo(tp, Animation.SLIDE);
}
else
{
Window.alert("Authentication Failed");
}
}
하지만. UIBinder 클래스 내에서 동일한 논리를 작성하면 정밀 검사를 수행 할 수 있습니다.
이제 클래스 개체를 사용하여 다른 클래스의 메서드를 사용하고 싶습니다.
누구에게 아이디어가 있습니까?
다른 클래스의 메소드 호출시이 오류를 해결하는 데 도움을주십시오.
미리 감사드립니다.
어쩌면 UmbrellaException을 추가해야합니다. –
자세한 설명은 여기에서 확인할 수 있습니다. http://stackoverflow.com/questions/12171744/gwt-class-method-of-different-class-not-calling-getting-umbrellaexception –