如何在GWT中实现激活参数?

时间:2021-06-24 20:09:13

I'm writing an editor in GWT, how can I pass the user/pass from the page? For example a user submits a simple html form and then an GWT app shows up in the next page, how can I get the form submission info into the GWT nicely?

我正在GWT编写一个编辑器,如何从页面传递用户/传递?例如,用户提交一个简单的html表单,然后在下一页显示GWT应用程序,如何将表单提交信息很好地提交到GWT?

Thanks.

1 个解决方案

#1


4  

1) Create a serializable bean to encapsulate the data to be posted.

1)创建一个可序列化的bean来封装要发布的数据。

2) In the servlet/JSP you are posting to, populate the bean from the posted parameters, and place it in the session.

2)在您发布的servlet / JSP中,从发布的参数填充bean,并将其放在会话中。

3) Create an RPC service that reads the bean from the session and returns it.

3)创建一个RPC服务,从会话中读取bean并返回它。

4) Call the service from your GWT application.

4)从GWT应用程序调用服务。

There are methods by which you can pre-call the service method from a JSP and serialize the results into a JS variable on the page, then deserialize from within GWT, but I wouldn't bother with it unless your page is very high traffic.

有一些方法可以从JSP预先调用服务方法,并将结果序列化为页面上的JS变量,然后从GWT中反序列化,但除非您的页面流量非常大,否则我不会打扰它。

All of this is a bit harder to do than just embedding the posted data in a JS block as a GWT Dictionary, but the Dictionary method makes it easier to just right-click and view the data. Since you mentioned this possibly containing a userid/password, I assumed this might not be acceptable.

所有这一切都比仅仅将发布的数据作为GWT字典嵌入JS块中更难做,但是Dictionary方法使得更容易右键单击并查看数据。由于您提到这可能包含用户标识/密码,我认为这可能是不可接受的。

#1


4  

1) Create a serializable bean to encapsulate the data to be posted.

1)创建一个可序列化的bean来封装要发布的数据。

2) In the servlet/JSP you are posting to, populate the bean from the posted parameters, and place it in the session.

2)在您发布的servlet / JSP中,从发布的参数填充bean,并将其放在会话中。

3) Create an RPC service that reads the bean from the session and returns it.

3)创建一个RPC服务,从会话中读取bean并返回它。

4) Call the service from your GWT application.

4)从GWT应用程序调用服务。

There are methods by which you can pre-call the service method from a JSP and serialize the results into a JS variable on the page, then deserialize from within GWT, but I wouldn't bother with it unless your page is very high traffic.

有一些方法可以从JSP预先调用服务方法,并将结果序列化为页面上的JS变量,然后从GWT中反序列化,但除非您的页面流量非常大,否则我不会打扰它。

All of this is a bit harder to do than just embedding the posted data in a JS block as a GWT Dictionary, but the Dictionary method makes it easier to just right-click and view the data. Since you mentioned this possibly containing a userid/password, I assumed this might not be acceptable.

所有这一切都比仅仅将发布的数据作为GWT字典嵌入JS块中更难做,但是Dictionary方法使得更容易右键单击并查看数据。由于您提到这可能包含用户标识/密码,我认为这可能是不可接受的。