1 回答

TA貢獻1829條經(jīng)驗 獲得超4個贊
操作字段中的查詢參數(shù)被忽略(提交帶有查詢字符串參數(shù)和隱藏參數(shù)的 GET 表單消失)。您應該將其添加為隱藏參數(shù)(如何在 gwt 的 formPanel 上添加隱藏數(shù)據(jù)):
FormPanel form = new FormPanel();
form.setEncoding(FormPanel.ENCODING_URLENCODED); // use urlencoded
form.setMethod(FormPanel.METHOD_GET);
FlowPanel fields = new FlowPanel(); // FormPanel only accept one widget
fields.add(new Hidden("entityId", "101")); // add it as hidden
form.setWidget(fields);
form.setAction(GWT.getModuleBaseURL() + "downloadfile");
form.submit(); // then the browser will add it as query param!
如果你不使用urlencoded它,它也可以使用request.getParameter(…),但它會在正文而不是 URL 中傳輸。
添加回答
舉報