GWT integration in existing Java EE application - gwt

I am new to GWT. I have developed a GWT application in version-1.6.4 and it is working fine. Now I want to integrate with that project in existing Java EE application. I don't know how to go ahead.
Where to copy the GWT source code in this existing Java EE application? I am also using RPC in GWT.
Can anyone provide help on this?

GWT is just a set of javascript and HTML files, so the most basic form of integration is just to put them in a folder in the same place your as your web pages go.
One step up from there would be to integrate the gwt Compiler in with your build process. If you use Netbeans there is a good plugin called GWT4NB that will handle all of this process for you, so that when you build the WAR of your project it will build the GWT portions of it as well. There would probably be something similar for Eclipse. You could also do all this by hand using maven or ant.
You would tell the compiler where you want it to put the generated files, which again, would be in the same location you put your web pages for your WAR project. The RPC side of it will still work just fine no matter where you put the files.

Related

I get "Can't find any GWT Modules on this page"

I am trying to set up my eclipse with gwt and after I installed Jdk 8 and eclipse 2019-06 and gwt eclipse plugin 3.0 I created the sample project with code generated and when I try to run the sample code in GWT Development mode it gives me url http://localhost:9876 and when I open it I get "Can't find any GWT Modules on this page" Can you please help why It is giving me Can't find any GWT Modules on this page. I am assuming if I am running it in development mode I don't need to set up web server so I didn't. I didn't used gwt for long time and I am lost why it is giving me this can't find gwt module message when I load the page. Can you please help?
You still need a server, if you want to run any java code on your server. Such as code for talking to your database.
Gwt only does 2 things:
1: is is handling the client side, where it generate javascript from your java code.
2: It includes a .jar file, which can be used together with a java servlet server such as apache tomcat to serialize java objects which can then be send between the client and the server. And this .jar file will serialize all needed objects. And gwt will generate the needed javascript code.
Gwt does not itself include any http server. The address http://localhost:9876 is only used to configure gwt. It is just a page with 2 buttons to turn dev mode on/off.
The eclipse plugin does include a embeded webserver which can be used for gwt development. I have newer done this and I think that installing an independent java tomcat server is the best solution.
But if you want to use the eclipse embeded webserver you need the "Run in development mode with Jetty." - Jetty is the name of the embeded java servlet server.
Are you using the plugin from Google ?
If so, this is outdated. I advice you to use the plugin from branflake. You can find this plugin on GitHub : https://github.com/gwt-plugins/gwt-eclipse-plugin
Also on that GitHub page a lot of documentation is available. Like a link to a very helpfull YouTube playlist: https://www.youtube.com/watch?v=DU7ZQVLR5Zo&list=PLBbgqtDgdc_TqzA-qXrjgTFMC_6DKAQyT
My advice is to watch these YouTube videos to get you started. If you follow them all should be working without a problem.
I haven't used this plugin for a while since I switched to IntelliJ. But I did use it in GWT2.8.2 so it should still work fine.

How to create a new JSP project in Eclipse using Maven and Jetty

I'm new to a number of technologies which I need to use together in a project. I have installed a Jetty plugin for eclipse and also got maven3 working with it.
I want to start a new web-app project from scratch which will use JSP, but I want it to follow the conventions for Maven projects.
I already know JSP so learning that isn't the challenge here, just getting the project set up.
Any help would be appreciated.
You can follow the tutorial here
http://wiki.eclipse.org/Jetty/Tutorial/Jetty_and_Maven_HelloWorld
The only difference in terms of what you want really is that instead of index.html in that example, you would use .jsp and the tags there you wish to use respectively.
The usage of maven, servlets and jetty would still be pretty much identical.

What IDE (Eclipse or Aptana) and What tools i need to develop a JSP Project

I need to create a web based project where I will use java codes to do the back-end processing and database connections. So I need to write my code in JSP. I already installed tomcat.
But in Aptana i do not get the option "New Dynamic Web Project". Which i have created JSP projects previously. Any one knows how to add it or what toold i need to install?.
I'm not a fan of Aptana; in my experience it's a bloated tool that tries to do too much and does nothing particularly well. I would just get the Eclipse IDE for Java EE Developers package from http://www.eclipse/downloads and use that.

GWT/Grails Project Structure

Does somebody already have some experience embedding gwt in other
client pages except the standard html file?
I want to use gwt as front end and grails as backend. Communication
should be handled over rest json interface so that is loosely coupled.
How do i structure my project at best? Should I create 2 independend
projects or should I stick them together?
At the beginning I had some problems with debugging my gwt application
as it was part of the grails project. Now I copied the compiled js
script to my webapp folder and included it in a grails page. Debugging
gwt in noserver mode worked ok. The problem is , how do I solve my
deployment later at best as I dont want to copy my js everytime by
hand? Already tried the grails gwt plugin but its difficult to debug the gwt application and I even do not want to use the service stuff provided with the plugin.
I thought its a good idea to have 2 maven modules on for grails and one for gwt. Later 2 war files(one grails, one gwt) will deployed on Tomcat, so I also can change gwt client stuff without deploying grails again. How do i manage the brige from grails to gwt best? Just call the standard html in a div from grails page?
I am using maven for building my project.
Thanks for all your help
I have written 2 posts about this topic. In the first one I show Grails+GWT in the same application, using the Grails Gwt Plugin. It appears you already tried that approach. In the second post, I show how to do it with 2 seperate applications, talking JSON between each other using RequestBuilder to request the grails app (that serves JSON responses).
For The deployment in production, you should have Maven doing this job for you.

How should I build a GWT application to a WAR file

I have a GWT application that I need to deploy from a WAR file. I've got it kinda working using export to WAR option in Eclipse but after I deploy all of images in the application just show as missing image icon, and besides when we have multiple developers it is not nice to build from IDE this way.
I am looking for if there is a best way to script the build process that people have found (hopefully with an example) such as an Ant xml or any other GWT specific tools?
This tutorial provides step by step instructions for writing an ant script to build the war file including GWT specific compile steps and where/how to package static resources such as images.
http://www.rubiconred.com/blog/build-package-a-gwt-app-to-war-using-ant/
You could look into the GWT maven plugin.
If you're new to GWT or Maven, you might want to first read the GWT documentation and get more familiar with Maven by reading at least its getting started guide or by reading the online reference book.