GWT and Tapestry 5 integration

297 views
Skip to first unread message

Daniel Jue

unread,
Jan 6, 2009, 1:51:39 PM1/6/09
to Google-We...@googlegroups.com
Hi,

I'm relatively new to GWT, but I've been working with Apache Tapestry
5 for a while now.
I've written a tutorial (with source code as an Eclipse project) on
the Tapestry Wiki. It's based on some older tutorials that are out
there (thanks Pär Dahlberg). It includes cases for using multiple
instantiations of an entrypoint on one page, each acting
independently. The source includes a single Tapestry page that runs
two simple dialog boxes, and two independant stock watchers. ( In
other examples online, there was no example for mixing in an RPC
entrypoint.)

http://wiki.apache.org/tapestry/Tapestry5GWTIntegration

This setup has Tapestry as the "parent" web app framework, which
handles multiple pages and components (and nested components). The
tutorial outlines a way to embed your GWT application as a component
on a page. (either the component template or the page template
supplies the html you were using in your .html files with GWT
development)

I am not using Hosted Mode in this tutorial. I got the Stock Watcher
app up and running in another project, and then copied the Java source
over. The tutorial uses Maven to build your entrypoints and feeds the
JS output back into the web app source. RPC Service class files end
up in the target dir with the Tapestry class files.

If you are interested, please let me know what improvements I can make.

Regards,

Daniel Jue

Daniel Jue

unread,
Jan 6, 2009, 1:51:39 PM1/6/09
to Google-We...@googlegroups.com

Casey

unread,
Feb 13, 2009, 7:48:27 AM2/13/09
to Google Web Toolkit
Thanks for putting this up. I'm going to take a look it at now.

Casey

unread,
Feb 15, 2009, 11:10:14 AM2/15/09
to Google Web Toolkit
Great sample project and instructions. I was able to get up and
running using Eclipse and Jetty.

Casey

unread,
Feb 15, 2009, 11:27:31 AM2/15/09
to Google Web Toolkit
Were you able to get this to work in GWT hosted mode?

Daniel Jue

unread,
Feb 15, 2009, 11:52:33 AM2/15/09
to Google-We...@googlegroups.com
Hi,

Thanks for trying out the tutorial. I hope this list doesn't mind the
cross traffic. Glad you were able to get it working with Jetty. My
projects have so many Tomcat dependencies that I tend to develop with
it exclusively, and haven't had much time to play with Jetty.

I didn't really try getting it to work in hosted mode. I don't think
hosted mode would handle loading the Tapestry servlet filter, but I
may be wrong. I'm still not very experienced in GWT project setups,
beyond the standard archetype.

I feel that if your entrypoint is self-reliant, you can have an HTML
file in your public directory, allowing you to do some rapid
development on a single entrypoint at a time. The HTML file in the
public directory is not being used by the application in the tutorial,
but could be used in development with some tweaking. --That is, the
public HTML files could be used as a development aids, but ultimately
the Tapestry templates will be hosting the entrypoints.

Tapestry uses templates with it's own DTD, but the syntax is so close
to HTML as to be editable by artsy web designers. It's not like a JSP
that gets turned inside out. The goal was to keep artsy designers
from messing up code, and keep the coders from trying to be artsy. ;-)

The person who wrote an older tutorial said he had his GWT entrypoints
as a separate project (with all the standard GWT project settings),
and then the source was combined into the main Tapestry application
later.

Casey

unread,
Feb 15, 2009, 1:31:29 PM2/15/09
to Google Web Toolkit
To me, GWT and Tapestry seem like the perfect mix so I was very
excited when I found your tutrial. I think it will be great to use
tapestry to do basic things like authentication and then use GWT to
enhance the UI. I have four years of experience with tapestry 3. 0 and
about a year with GWT 1.4. Unfortunately that has been followed by
about 9 months off but I'm trying to get back to it.

Anyway, in my previous GWT 1.4 project, I developed in Eclipse and I
was able to have Jetty host the back end while using a Java
application launcher to run the GWT hosted browser in no server mode.
Unfortunately I haven't had any such luck trying to get the your GWT
components running either in full hosted mode or no server mode. I've
targeted the StockWatcher module since it's the only one with an html
file in the public directory but when it launches I get the following
error:

[ERROR] Unable to find type
'se.pmdit.tutorial.t5gwt.gwt.client.StockWatcher'
[ERROR] Hint: Check that the type name
'se.pmdit.tutorial.t5gwt.gwt.client.StockWatcher' is really what you
meant
[ERROR] Hint: Check that your classpath includes all required source
roots

I've specifically added the src directory to the Java app but still no
luck. With your sample project, are you able to launch hosted mode for
a single (or multiple) module? Like you said, I really want to shoot
for a rapid development environment where you could develop tapestry
and GWT and the same time.

On Feb 15, 11:52 am, Daniel Jue <teamp...@gmail.com> wrote:
> Hi,
>
> Thanks for trying out the tutorial.  I hope this list doesn't mind the
> cross traffic.  Glad you were able to get it working with Jetty.  My
> projects have so many Tomcat dependencies that I tend to develop with
> it exclusively, and haven't had much time to play with Jetty.
>
> I didn't really try getting it to work in hosted mode.  I don't think
> hosted mode would handle loading the Tapestry servlet filter, but I
> may be wrong.  I'm still not very experienced in GWT project setups,
> beyond the standard archetype.
>
> I feel that if your entrypoint is self-reliant, you can have an HTML
> file in your public directory, allowing you to do some rapid
> development on a single entrypoint at a time.  The HTML file in the
> public directory is not being used by the application in the tutorial,
> but could be used in development with some tweaking.   --That is, the
> public HTML files could be used as a development aids, but ultimately
> the Tapestry templates will be hosting the entrypoints.
>
> Tapestry uses templates with it's own DTD, but the syntax is so close
> to HTML as to be editable by artsy web designers.  It's not like a JSP
> that gets turned inside out.  The goal was to keep artsy designers
> from messing up code, and keep the coders from trying to be artsy. ;-)
>
> The person who wrote an older tutorial said he had his GWT entrypoints
> as a separate project (with all the standard GWT project settings),
> and then the source was combined into the main Tapestry application
> later.
>

Casey

unread,
Feb 15, 2009, 2:19:51 PM2/15/09
to Google Web Toolkit
Got it! Apparently under the lanucher classpath entries, pointing the
src directory was not enough. I had to place an entry to src/main/
java. I am now able to edit tapestry pages and GWT components in the
hosted mode browser without the need to refresh any directories. All
changes are live! I could possibly be missing something but so far
I've editied the GWT java files and the Tapestry Start.html, both are
in the source directory, and both changes show up in the browser
without the need for a restart. Here is what I did:

Back End., I like to you the JettyLanucher Eclipse plugin so I created
a new Jetty Launch dialog and pointed it to my jetty.xml file.My VM
arguments are as follow
-Djetty.home="/Users/casey/Projects/opt/jetty-5.1.11RC0"
-Dorg.apache.tapestry.disable-caching=true
-DignoreDuplicateModuleError=true
-Xmx512m
-Xms128m
-XX:PermSize=256M

Now that I have the back end up and running like a regular tapestry
project, I want to run GWT in hosted mode so that I can make like
changes to GWT components without having to run the maven GWT compile
command and then refreshing the src/main/webapp directory in eclipse.

1. Go to the debug menu and create a new Java Application Launcher
2. On the main tab set the following:
a. Project to myapp
b. Set the main class to com.google.gwt.dev.GWTShell
3. On the arguments tab:
a. Set the program arguments to: -noserver -out www -whitelist
"localhost[:]8080" -port 8080
b. Set the VM arguments to:
-XstartOnFirstThread
-Xmx512M
4. On the Classpath tab, select the user entries click the Advanced
button and choose add folder. Then select the src/main/java folder.
This must be the java folder and not the src folder. I have the java
folder ahead of the myapp entry but I'm not sure if it makes a
difference.
5. Everything else stays the same so just click the Debug button.

At this point you clicked the Debug button for both your Jetty entry
and the Java application entry. Both need to be running at the same
time.

6. When the GWT Hosted Browser pops up, click the Hosted Browser
button. At that point, you should be able to make changes to tapestry
and GWT. Let me know if you have any problems.
Reply all
Reply to author
Forward
0 new messages