GWT MVP 问题
我是 GWT 的新手。我正在尝试使用 MVP 实现我的代码。
因此,按照教程,
- 我创建了一个
View
, - 创建了一个
Presenter
, - 在演示者内部创建了一个
Display
界面, - 我的视图实现了我的
Presenter.Display
接口。
只是为了概念证明,我在视图中创建了一个 Button
。在我的演示器中,我编写了 ClickHandler
。
现在,当我调试这个项目时,我可以看到我的视图,但我在演示者中分配的功能尚未实现。换句话说,View 和 Presenter 并没有绑定在一起。
我如何绑定它们?我错过了什么吗?
谢谢
I am a newbie to GWT .I am trying to implement my code using MVP.
So following a tutorial
- I have created a
View
, - I have created a
Presenter
, - I created a
Display
interface inside the presenter, - My view implements my
Presenter.Display
interface.
Just for the proof of concept I created a Button
in the View. In my presenter I wrote the ClickHandler
.
Now when I debug this project I can see my view but the functionality I have assigned in my presenter is not implemented. In other words, the View and the Presenter are not binded together.
How do I bind them? Am I missing something?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的项目中使用GIN吗?
您可以发布您的视图和演示者代码以及绑定它们的位置吗?
您可以使用以下方式绑定视图和演示者:
您是否在演示者模块中添加了上述代码?
Are you using GIN in your project?
Can you post your code of view and presenter and where you are binding them.
You cam bind view and presenter using:
Have you added above code in your Presenter module?
您在哪里创建视图和演示者?创建它们时,将视图传递给演示者,例如作为演示者构造函数中的参数。像这样
在 MyPresenter 中...
希望这会有所帮助。
Where do you create the view and the presenter? When creating them, pass the view to the presenter for example as an argument in the Presenters constructor. Like this
then in MyPresenter...
Hope this helps.