How to post data and redirect to another page using GWT?

前端 未结 2 810
孤街浪徒
孤街浪徒 2021-01-14 14:39

When I press a button I post some data to server and there redirect to another page. I used RequestBuilder but it is waiting the response, and of course get it. And nothing

相关标签:
2条回答
  • Add more specifications, code, this is blur. Since you are using Spring-mvc, you should be having something like this

     private static final String newPage = "index2";  //this is resolved with view resolver
     @RequestMapping(params = "action=button")
     protected String getALPLicense(final RenderRequest request,
                final RenderResponse response, final Model model) throws Exception {
     try{
     }catch{
     }
     return newPage;  //this is your new redirected page
     }
    
    0 讨论(0)
  • 2021-01-14 15:25
        FormPanel form = new FormPanel("_self");
        form.setMethod(FormPanel.METHOD_GET);
    
        Hidden params0 = new Hidden("param1", "value1");
        Hidden params1 = new Hidden("param1", "value2");
        Hidden params2 = new Hidden("param2", "value3");
    
        FlowPanel panel = new FlowPanel();
        panel.add(params0);
        panel.add(params1);
        panel.add(params2);
    
        form.add(panel);
    
        form.setAction(GWT.getModuleBaseURL() + "../MyServlet");
        RootPanel.get().add(form);
        form.submit();
    

    Thats it. The code adds FormPanel and sends form.

    0 讨论(0)
提交回复
热议问题