📜 ⬆️ ⬇️

Creating a GWT application with GWT-Ext controls running on JBoss using NetBeans. Step by step

I decided to share with the general public how to create a full-fledged GWT application using NetBeans, as well as how to deploy it to the JBoss application server. Unfortunately, I did not find a complete description of this process on the network (there are articles separately for GWT, separately for GWT-EXT and separately for JBoss), so I decided to put everything in one pile. I hope someone this guide is useful and will serve as a starting point. So let's get started.

Caution! Many great screenshots

We will need:


- Sun JDK v1.6
- JBoss Application Server v4.2.3 GA
- NetBeans v6.5.1
- Google Web Toolkit 1.6.4
- GWT-Ext v2.0.5
- ExtJS v2.0.2 or extjs.com/products/extjs/download.php

A couple of moments


- In my guide, I will use the C:/Java. folder C:/Java. In it, I will put all the necessary things. I advise you to do the same.
- Remember that when setting the environment variables of Windows XP, it is better to reboot
')

Step 1. Install Java


How to install java, I probably will not tell. Here everything is already chewed and chewed many times. I can only say that full working capacity requires that the variable JAVA_HOME be written in the environment variables.

Step 2. Unpacking all archives and environment variables


Archives need to unpack as follows. Do not forget to register the environment variable.
Sun JDK v1.6C: \ Java \ JdkJAVA_HOME
JBoss Application Server v4.2.3 GAC: \ Java \ JBossJboss_home
Google Web Toolkit 1.6.4C: \ Java \ GWTGWT_HOME
GWT-Ext v2.0.5C: \ Java \ GXTGXT_HOME

image
image

Step 3. Launch JBoss


After unpacking, go to JBoss / bin and run run.bat. If everything went well, then we should see the following:
image

Step 4. NetBeans and Install the GWT4NB Plugin


After installing NetBeans, you need to go to Tools -> Plugins. There in the tab choose the plugin GWT4NB. After installing the plugin should get the following:
image

Step 5. Creating a web project


image
image
image
image
image
image
image
image
image

Step 6. Trial publication of the project


Right-click on the project and select the Deploy item. Since we already launched JBoss, NetBeans will compile the project and put it on the server itself. It should turn out like this:
image
Now the project is available at the following address: http: // localhost: 8080 / SampleGwtApplication . There will be a button labeled.

Step 7. We learn a client part to pull a server code. AJAX in action


For this we need to create a service. We poke the right button on the project.
image
image
image

After NetBeans generates the necessary classes, go to MainModuleEntryPoint.java and write the following to the onModuleLoad function:
image
We publish the project again. After compiling on the project page ( http: // localhost: 8080 / SampleGwtApplication ) a text box and a button will appear. The button will send a full Ajax request to the server. Details about the device services and how they work with the client to read on the Internet.

Step 8. Screw GWT-Ext


The first thing you need to do is connect to the libraries of the GWT-Ext project. To do this, we right-click on the project libraries and select “Add Library ..”.
image
... creating a new library in NetBeans
image
We specify the library itself, which we have is C: \ Java \ GXT \ gwtext.jar
image
... and its documentation
image
Now in the MainModule.gwt.xml file we add one line:
image
Now in the code MainEntryPoint.java we can use GWT-Ext controls. However, this is not enough for everything to work. It is also necessary to put ExtJS client scripts in the project. To do this, you need to create in the web folder the scripts, css and images folders. Like here:
image
... from the ext-2.0.2.zip archive into the scripts folder you need to put the adapter and ext-all.js
image
... in the css folder you need to put the contents of ext-2.0.2.zip/resources/css
image
... in the images folder you need to put the contents of ext-2.0.zip/resources/images
image
... now we connect these scripts in the page. Writing such things in the welcomeGWT.html file ...
image
Remained a little. In the code MainModuleEntryPoint.java we write the creation of a GWT-Ext panel and buttons for it. Similarly, you can use other package controls com.gwtext.client.widgets
image
Publish the project again and see the result.
image
That's all. Thanks for attention.

PS Sorry for the awkwardness of the syllable and the big pictures. Time is 23.41, and I'm still at work. I try for you.

Source: https://habr.com/ru/post/62744/


All Articles