0

我正在尝试从 GWT 演示者小部件获取 URL 参数,但收到以下错误消息:

The method prepareFromRequest(PlaceRequest) of type ViewDiagramPresenter must override or implement a supertype method
The method prepareFromRequest(PlaceRequest) is undefined for the type PresenterWidget<ViewDiagramPresenter.MyView>

有任何想法吗?谢谢你

public class ViewDiagramPresenter extends
        PresenterWidget<ViewDiagramPresenter.MyView> {
[...]

@Override
     public void prepareFromRequest(PlaceRequest placeRequest) {
       super.prepareFromRequest(placeRequest);
       String actionString = placeRequest.getParameter("action", "view");
    }
[...]
}
4

2 回答 2

0

该类PresenterWidget似乎没有一个名为prepareFromRequest(). 也许您的意思是Presenter从 gwtp 扩展类?

于 2012-10-22T23:50:50.067 回答
0

将 注入您的 PresenterWidget 并在方法PlaceManager中处理 url 。onReset()

public class ViewDiagramPresenter extends
        PresenterWidget<ViewDiagramPresenter.MyView> {

    protected final PlaceManager placeManager;

    @Inject
    public ViewDiagramPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, final PlaceManager placeManager) {
        super(eventBus, view, proxy);
        this.placeManager = placeManager;
    }

    @Override
    public void onReset() {
        super.onReset();
        PlaceRequest placeRequest = placeManager.getCurrentPlaceRequest();
        String actionString = placeRequest.getParameter("action", "view");
    }
}
于 2012-10-23T08:45:25.217 回答