GWT learning summary.

Source: Internet
Author: User
The world is messy now. Ajax is used for both external and external use,
To join this army, I naturally learned about Ajax,
By the way, I naturally don't have much affection for the annoying, messy, and difficult-to-schedule JavaScript,
But it is impossible not to learn.
It's time to find a job.
..............................
Learn and learn,
I looked at the Google lab and saw Google Web Toolkit,
This can make me happy.

With my English proficiency, it is enough to see the document. (I have also mentioned that I have translated tens of thousands of English nutch documents ,)

........................
After getting started with GWT, start to read the develop guide.

...........
There are two main aspects: client and RPC,

The client is viewr on Brouwer, which is almost the same as AWT in Java. If you are familiar with AWT, you can use it directly.

The other is RPC,
Two interfaces, one implementation completes one module as one server.
The following public interface myservice extends remoteservice ...{
Public String mymethod (string S );
} Interface myserviceasync ...{
Public void mymethod (string S, asynccallback callback );
} Public class myserviceimpl extends remoteserviceservlet implements
Myservice ...{

Public String mymethod (string s )...{
// Do something interesting with's here on the server.
Return S;
}

}

If you use GWT and Hibernate to make a small thing, you can use it.
The following figure shows the rpc uml diagram.

Why is this asynchronous interface required?

Because of the principle of Ajax, this is an intermediate layer between Brouwer and sever, so that Brouwer does not need to be refreshed.

One major problem is the itegration of gwtt and Struts. Although there are several articles, it is not clear how to use them in depth. I will write it here today.
 
The following reply is displayed on the Google GWT forum and is more practical.
//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// //// //> Because I don't find it obvious how to pass
> GWT-variables to struts forms.

I guess that is what I am getting at... You wouldn't pass anything
Struts. Once you deliver that first HTML page with GWT code in it, the page
Wocould never refresh. The HTML page wocould never change.

... Instead the page wocould pass the form data as a Java Bean, which wowould
Then be validated/stored on the server, and the server wocould return a Java
Value. The return value might be a Boolean to indicate success, or an error
Object To indicate failure, or some other Java object that holds return
Data.

Or to summarize, once the first page is served, the only data passed
The server and the client are Java objects.

But again, it all depends on what you need to do. A friend of mine is
Looking into using GWT for an application solution, who is also a big fan
Struts. His specific problem was that he wanted a tabbed panel, and each
Pane wocould be a different web page, and I assume that means a struts
Action. I provided a solution that looks like this...

// Create a tabbed panel, and add it to the page
Tabpanel TP = new tabpanel ();
Rootpanel. Get (). Add (TP );

// Create two frames, pointing to struts actions
Frame frame1 = new frame ("/frame1action. Do ");
Frame frame2 = new frame ("/frame2action. Do ");

// Add the frames to the Panel
TP. Add (frame1 );
TP. Add (frame2 );

He had a follow-up question asking how he wocould pass variables to the struts
Actions. My response was to pass them in the URL.

Frame1.seturl ("/frame1action. do? Foo = 1 & bar = 2 ");

In his application the contents of the frames are struts actions, and are
Not GWT enabled. What is GWT enabled is the container that holds
Frames.

Another situation might be that you want to provide the user with
Calculator (or calendar, color picker, etc) tool to help them fill in a form
Field. Here is an example:
Http://gwt-widget.sourceforge.net/demo/calc/index.html.

In the example the result of the calculation is placed in text box, which
Cocould then be submitted to a struts action in the normal way. This is
Example of enhancing the page with no need for server-side integration.

So the answer is, it depends. It depends on the specific problem.

There is no requirement that the whole page use GWT Widgets. So you cocould
Use a single calulator tool widget or a few frame widgets, yet leave
Reast of the application the way you normally wowould.

I don't know if I am answering the question or just babeling at this point,
But I do have a recommendation for server-side integration with struts.

1. Don't tie your business logic to the struts action.
2. Create business logic components that can be used by both struts actions
And GWT servlets.
3. Use the appropriate tool, either struts action or GWT servlet depending
On what you are doing.

Here is an example. Lets say that you have a form for gathering sign-up
Information. The initial form page wowould probably be a plain HTML page
Served to the user. This page wowould have GWT code in it to allow
Client-side validation of the entries.

(Form entry) The user enters their name into the first field, and moves
The second field. The client-side GWT code immediately sends the value
The first field to the server for validation. The idea being that we want
To make the sign-up process painless, and point our entry errors as soon
Possible.

(Client-side validation) The server call is done through a GWT servlet,
Which then passes the value to some business module, and returns the result
To the browser. While the user is filling out the form we only ever call
GWT servlets.

(Form submission) once the user is entering data they submit the form to
Server for processing. In this example this submission it to an ordinary
Struts action, and the data is submitted in the normal way, using an html
Form.

(Server-side validation) the struts action still needs to validate the entry
Because it isn' t a great idea to rely on only client-side validation. In
This case the struts action callthe same business module that the GWT
Servlet used.

In this example there is integration between struts and GWT, but only where
It makes sense to do so to solve the given problem.

I don't know if that helps, but maybe you can see what I am getting at. If
You have a specific problem that needs a solution I wocould be interested in
Hearing what it is.

Rob

On 7/22/06, Joachim <Tristan.Ro...@gmail.com> wrote:

-Hide quoted text -- show quoted text-

 

 

Thanks for your explanations.

My specific problem was about "form submission", and submittingGWT
Generated values to the server using a simple post to an action, and
Not RPC, but I found the answer in your formpanel:

/**
* Adds a widget to the underlying panel and sets the "name"
* Attribute. This will allow the value of the form field
* Be passed to the server when the form is submitted.
*
* @ Param field the widget to add to the form
* @ Param name the form field name
* @ Return false if widget can not be added
*/
Public Boolean addfield (widget field, string name)
{
<B> Dom. setattribute (field. getelement (), "name", name); </B>
Return add (field );
}

Robert Hanson a é crit:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.