tags:

views:

414

answers:

1

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?

Thanks.

+2  A: 

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

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

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

4) Call the service from your GWT application.

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.

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.