How to combine a GWT project (Google Web Toolkit) and a dynamic web project (i.e. a web application / Java servlets) in Eclipse?

I currently have a main Java Web App project that hosts some servlets, JSPs, and static HTML pages. Later, I also created a second Eclipse Google Web Toolkit (GWT) project. Now, after completing the GWT project, I want to integrate or merge the GWT project (while retaining the RPC capabilities with Servlets) using the Primary Java Web App project. In which directory do I need to copy files and folders from the GWT project to the Java Web App Project? Keep in mind that I want to export fully compiled JavaScript code, not Java byte code.

+6
java eclipse servlets gwt iframe
source share
2 answers

You can put all the Java files from your GWT project exactly where they were in the GWT project. I think your gwt.xml file may remain unchanged. In your web.xml file, you need to define the servlet (s) that you use in GWT, for example, if gwt.xml has <servlet path="/MyService" class="com.catfish.server.MyServiceImpl"/> , then web.xml is required:

 <servlet> <servlet-name>MyService</servlet-name> <servlet-class>com.catfish.server.MyServiceImpl</servlet-class> </servlet> 

and

 <servlet-mapping> <servlet-name>MyService</servlet-name> <url-pattern>/module-path/MyService</url-pattern> </servlet-mapping> 

Then use ant build script to compile GWT in WebContent / module-path. You can still start your GWT project using the standalone GWT browser, but if you want to run everything together, you compile the GWT project and then run Tomcat or Jetty or any other servlet engine that you use. And you will need to put the path to your generated GWT JavaScript application on any JSP or static page.

+2
source share

If you only want to move the compiled javascript code, put it in the shared directory: ie

 web-root/www 
+1
source share

All Articles