Reputation: 1090
I'am trying to Redirect to an URL with Post Parameters. Therefor i am using a DynamicForm. My code Looks like:
DynamicForm postForm = DynamicForm();
postForm.setCanSubmit(true);
postForm.setMethod(FormMethod.POST);
postForm.setAction(URL_OF_WEBSITE + POST_PARAMS);
addChild(postForm);
ActionHandler of a Button:
postForm.submitForm();
I debuged and the submitForm(); button is called. But nothing happened. Whats my mistake?
Thank you in advance!
Upvotes: 0
Views: 1187
Reputation: 46841
What JavaDoc of DynamicForm#submitForm() says:
this is used only in the very rare case that a form is used to submit data directly to a URL. Normal server contact is through DataBound Component Methods.
In SmartGWT
each DynamicForm
is bound to a DataSource
and you can call different methods on DynamicForm
to add/delete/update the record in the database directly.
I expecting that the new window where i submiting will open in my browser.
If you want to call any URL then simply use Window.open(servletURL+query-params,"","")
and pass the data in query string that is accepted as GET request by the Servlet.
Sample code:
String servletName = GWT.getModuleBaseURL().replace("/" + GWT.getModuleName(), "")
+ "myServlet?key1=value1";
Window.open(servletName, "", "");
//Window.open(servletName, "_self", "");
Upvotes: 1