GWT FormPanel 并将数据提交到服务器

发布于 2024-10-17 14:30:31 字数 541 浏览 6 评论 0原文

我有一个 GWT 应用程序,我需要将 FormPanel 放在文本框 (TextBox) 中。 (解决一些样式问题)

编辑: 样式问题是:我们正在使用一些预构建的样式表,它们通过 HTML 标记名称放置样式..因此我们需要放置一个 form 标记来包装一些组件以便能够读取风格!

问题是,在 KeyPress 事件中,我注意到页面中出现了加载。尽管结果返回ajaxaly,就好像没有发生客户端-服务器旅行一样。

问题是,如何去掉这行服务器呢?

注意:我只是将组件包装到表单面板中,我没有设置它的任何属性:

FormPanel formPanel = new FormPanel();
CaptionPanel captionPanel = new CaptionPanel();
formPanel.add(captionPanel);
captionPanel.add(horizontalPanel);
verticalPanel.add(formPanel);

谢谢。

I've a GWT app that I need to put FormPanel to wrap a textbox (TextBox). (to solve some styling issue)

EDIT:
The style issue is that: we are using some pre-build style sheet which put styles by HTML tag names .. so we need to put a form tag to wrap some components in order to be able to read the styles!

the problem is, on the KeyPress event, I notice there is a loading in the page appears. although the result returns ajaxaly as if there's no client-server trip happened.

The question is, How to remove this trip to server?

NOTE: i am just wrapping the componenets into the formpanel, I've not set any properties of it:

FormPanel formPanel = new FormPanel();
CaptionPanel captionPanel = new CaptionPanel();
formPanel.add(captionPanel);
captionPanel.add(horizontalPanel);
verticalPanel.add(formPanel);

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半世晨晓 2024-10-24 14:30:31

从您的问题来看,尚不清楚是什么原因导致服务器访问。但如果是 FormPanel 导致了此问题,我会将 FormPanel 的实例化更改为以下内容:

FormPanel formPanel = new FormPanel() {
    public boolean onFormSubmit() { return false; }
};

这应该相当于以下 html,这将使表单无法提交:

<form onsubmit="return false">

如果这不能解决问题,那么您'您需要进行更多调试才能查看服务器被调用的位置。适用于 Firefox 的 Tamper Data 插件可能会有所帮助为了这。

From your question, it isn't clear that what is causing the trip to the server. But if it is the FormPanel that's causing this, I would change the instantiation of the FormPanel to the following:

FormPanel formPanel = new FormPanel() {
    public boolean onFormSubmit() { return false; }
};

This should be the equivalent of the following html, which will keep the form from submitting:

<form onsubmit="return false">

If this doesn't fix it, you'll need to do some more debugging to see where the server is being called. The Tamper Data plug-in for Firefox might be of help for this.

陈独秀 2024-10-24 14:30:31

FormPanel 的全部要点是创建一个 classis HTML 样式表单提交。它应该用于实现与需要表单提交的服务器的互操作性。

不要仅仅为了解决“一些样式问题”而使用 FormPanel。

OTOH,如果您需要从服务器检索一些 AJAX 风格的数据,请阅读 http://code.google.com/webtoolkit/doc/latest/tutorial/JSON.html#http

The whole point of FormPanel is to create a classis HTML-style form submission. It should be used to achieve interoperability with servers that require form submission.

Don't use FormPanel just to solve "some styling issues".

OTOH, if you need to retrieve some data from the server, AJAX-style, than read http://code.google.com/webtoolkit/doc/latest/tutorial/JSON.html#http

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文