1

好吧,它很简单,基本上我想遵循 GWT 的“一页”范式,并将 Spring 安全性集成到应用程序中。我的理解是,如果在系统中找不到 cookie,spring 会将用户重定向到 Open id referrer 页面,要求登录,否则它只会向我的服务器发送用户的 open url id。

这是我在 GWT 中尝试的:

        final FormPanel formPanel = new FormPanel();
        RootPanel.get("openId").add(formPanel);
        VerticalPanel openIdContainer = new VerticalPanel();
        formPanel.add(openIdContainer);

        TextBox url = new TextBox();
        url.setText("https://www.google.com/accounts/o8/id");
        url.setName("j_username");
        openIdContainer.add(url);

        formPanel.setAction("j_spring_openid_security_check");
        formPanel.setMethod(FormPanel.METHOD_POST);

        Button btn = new Button("Open ID");
        btn.addClickListener(new ClickListener() {
            public void onClick(Widget sender)
            {
                formPanel.submit();
            }
        });
        openIdContainer.add(btn);        

        formPanel.addFormHandler(new FormHandler() {
            public void onSubmit(FormSubmitEvent event)
            {
                System.out.println("On Submit invoked " +event.isCancelled());
            }
            public void onSubmitComplete(FormSubmitCompleteEvent event)
            {
                System.out.println("On Submit Complete invoked " + event.toString());
            }

        });

相应的输出: On Submit invoked false On Submit Complete invoked null

据我了解,收到的 html 为空。我还应该怎么做?GWT 1.5 没有简单的表单(确实会在提交时刷新页面)和类型为提交的输入标记。我是否必须将其硬编码到 HTML 小部件中?我尝试将另一个框架设置为此表单面板的目标,但仍然无法获得任何富有成效的结果。

4

1 回答 1

0

据我所知,您没有设置正确的上传 URL:

formPanel.setAction(uploadServiceUrl);

/**
   * Sets the 'action' associated with this form. This is the URL to which it
   * will be submitted.
   * 
   * @param url the form's action
   */
  public void setAction(String url) {
    getFormElement().setAction(url);
  }
于 2010-03-03T08:08:42.470 回答