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 you can create a full-fledged GWT application using NetBeans, as well as how to deploy it on the JBoss application server. Unfortunately, I did not find a complete description of this process on the network (there are articles separately on GWT, separately on GWT-EXT and separately on JBoss), so I decided to put everything together. I hope this guide is useful to someone and serves as a starting point. So let's get started.
Caution! Lots of great screenshots
- 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
- In my guide I will use the folder
- Remember that when setting environment variables for Windows XP it is better to reboot
I probably won’t tell how to install Java. Everything has already been chewed and chewed many times. I can only say that full operability requires that the JAVA_HOME variable be registered in the environment variables .
Archives need to be unpacked as follows. Remember to write environment variables.
After unpacking, go to JBoss / bin and run run.bat. If everything went well, then we should see the following:
After installing NetBeans, go to Tools -> Plugins. There, in the tab, select the GWT4NB plugin. After installing the plugin, the following should happen:
Right-click on the project and select Deploy. Since JBoss is already running, NetBeans will compile the project and put it on the server on its own. It should look like this:
Now the project is available at the following address: http: // localhost: 8080 / SampleGwtApplication . There will be a button with an inscription.
To do this, we need to create a service. Right-click on the project.
After NetBeans generates the necessary classes, go to MainModuleEntryPoint.java and write the following to the onModuleLoad function:
Publish the project again. After compilation, a text box and a button will appear on the project page ( http: // localhost: 8080 / SampleGwtApplication ). 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.
The first thing to do is connect to the libraries of the GWT-Ext project. To do this, right-click on the project libraries and select "Add Library ..".
... create a new library in NetBeans.
Specify the library itself, which we have C: \ Java \ GXT \ gwtext.jar
... and the documentation for it.
Now in the MainModule.gwt.xml file we add one line:
Now in the code of 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, create scripts, css and images folders in the web folder. Like here:
... from the ext-2.0.2.zip archive, you need to put adapter and ext-all.js in the scripts folder
... in the css folder you need to put the contents of ext-2.0.2.zip/resources/css
... in the images folder you need to put the contents of ext-2.0.2.zip/resources/images
... now we connect these scripts in the page. We write such things in the welcomeGWT.html file ...
Only a little remains. In the MainModuleEntryPoint.java code, we write the creation of the GWT-Ext panel and buttons for it. In the same way, you can use other control pack com.gwtext.client.widgets
Again we publish the project and see the result
That's all. Thanks for attention.
PS Sorry for the awkwardness of the syllable and large pictures. Time is 23.41, and I'm still sitting at work. I’m trying for you.
Caution! Lots of 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
Couple of points
- In my guide I will use the folder
C:/Java.
In it I will put all the necessary things. I advise you to do the same. - Remember that when setting environment variables for Windows XP it is better to reboot
Step 1. Install Java
I probably won’t tell how to install Java. Everything has already been chewed and chewed many times. I can only say that full operability requires that the JAVA_HOME variable be registered in the environment variables .
Step 2. Unpacking all archives and environment variables
Archives need to be unpacked as follows. Remember to write environment variables.
Sun JDK v1.6 | C: \ Java \ Jdk | JAVA_HOME |
JBoss Application Server v4.2.3 GA | C: \ Java \ JBoss | JBOSS_HOME |
Google Web Toolkit 1.6.4 | C: \ Java \ GWT | GWT_HOME |
GWT-Ext v2.0.5 | C: \ Java \ GXT | GXT_HOME |
Step 3. Launch JBoss
After unpacking, go to JBoss / bin and run run.bat. If everything went well, then we should see the following:
Step 4. NetBeans and installing the GWT4NB plugin
After installing NetBeans, go to Tools -> Plugins. There, in the tab, select the GWT4NB plugin. After installing the plugin, the following should happen:
Step 5. Creating a web project
Step 6. Test publication of the project
Right-click on the project and select Deploy. Since JBoss is already running, NetBeans will compile the project and put it on the server on its own. It should look like this:
Now the project is available at the following address: http: // localhost: 8080 / SampleGwtApplication . There will be a button with an inscription.
Step 7. We teach the client part to pull the server code. AJAX in action
To do this, we need to create a service. Right-click on the project.
After NetBeans generates the necessary classes, go to MainModuleEntryPoint.java and write the following to the onModuleLoad function:
Publish the project again. After compilation, a text box and a button will appear on the project page ( http: // localhost: 8080 / SampleGwtApplication ). 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. Fasten the GWT-Ext
The first thing to do is connect to the libraries of the GWT-Ext project. To do this, right-click on the project libraries and select "Add Library ..".
... create a new library in NetBeans.
Specify the library itself, which we have C: \ Java \ GXT \ gwtext.jar
... and the documentation for it.
Now in the MainModule.gwt.xml file we add one line:
Now in the code of 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, create scripts, css and images folders in the web folder. Like here:
... from the ext-2.0.2.zip archive, you need to put adapter and ext-all.js in the scripts folder
... in the css folder you need to put the contents of ext-2.0.2.zip/resources/css
... in the images folder you need to put the contents of ext-2.0.2.zip/resources/images
... now we connect these scripts in the page. We write such things in the welcomeGWT.html file ...
Only a little remains. In the MainModuleEntryPoint.java code, we write the creation of the GWT-Ext panel and buttons for it. In the same way, you can use other control pack com.gwtext.client.widgets
Again we publish the project and see the result
That's all. Thanks for attention.
PS Sorry for the awkwardness of the syllable and large pictures. Time is 23.41, and I'm still sitting at work. I’m trying for you.