Using Multiple EntryPoints within a Web Application

1,962 views
Skip to first unread message

manish

unread,
Aug 10, 2006, 8:00:43 PM8/10/06
to Google Web Toolkit
Hi

Can anyone show me how to create a web application which uses mutiple
HTML pages with each page using a unique GWT Entryclass?

I am tryimg to use GWT based Dialog Boxes in my application. When I
first created the project , I only created it for "DialogBox1". Then I
aded another entrypoint class class for DialogBox2". When I build and
deplopy the application, DilaogBox1 works, while the newer entrypoint
class fails.

Here is my project directory structure:

page1.html -- this neeeds DialogBox1.java (which implements
entrypoint)
page2.html -- this neeeds DialogBox2.java (which implements
entrypoint)

My directory structure is as follows

--com/blah/DialogBox1.gwt.xml
--com/blah/DialogBox2.gwt.xml

--com/blah/client/DialogBox1.java
--com/blah/client/DialogBox2.java

--com/blah/public/page1.html
--com/blah/public/page2.html

In my ant script, I have two targets,

<target name="gwt-compile" description="Generate clientside content
with GWT" depends="gwt-compile-1,gwt-compile-2"/>

<target name="gwt-compile-1" description="Generate clientside content
with GWT">
<mkdir dir="build/gwt-generated"/>
<java classpathref="gwt-classpath"
classname="com.google.gwt.dev.GWTCompiler" fork="true">
<classpath>
<pathelement path="src/java"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<arg value="-out"/>
<arg value="build/gwt-generated"/>
<arg value="-style"/>
<arg value="DETAILED"/>
<arg value="com.blah.DialogBox1"/>
</java>
</target>

<!-- second -->
<target name="gwt-compile-2" description="Generate clientside content
with GWT">
<mkdir dir="build/gwt-generated"/>
<java classpathref="gwt-classpath"
classname="com.google.gwt.dev.GWTCompiler" fork="true">
<classpath>
<pathelement path="src/java"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<arg value="-out"/>
<arg value="build/gwt-generated"/>
<arg value="-style"/>
<arg value="DETAILED"/>
<arg value="com.blah.DialogBox2"/>
</java>
</target>

Syed

unread,
Aug 11, 2006, 1:55:59 AM8/11/06
to Google Web Toolkit
u need to add meta and script tag in the html page for the module that
is being used in that html page.

Syed

unread,
Aug 11, 2006, 2:02:24 AM8/11/06
to Google Web Toolkit
here is an example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<meta name='gwt:module'
content='gwt/com.dps.hrms.pr.validator.gwt.AdvanceSalaryClient/com.dps.hrms.pr.validator.gwt.AdvanceSalaryClient'>


<%@ include file="/templates/HeaderIncludes.jsp" %>
</head>
<body>
<script type="text/javascript"
src="gwt/com.dps.hrms.pr.validator.gwt.AdvanceSalaryClient/gwt.js"></script>

<div id="disableSlot1"></div>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" cellpadding="0" cellspacing="0"
class="bannerWidth">
<tr>.............................................................
........................................................................

obviously, dots r not a part of it ;) one important thing. script tag
should come right after the body tag.

Feng Jiang

unread,
Aug 11, 2006, 9:06:11 AM8/11/06
to Google Web Toolkit
I think you don't have to use two *.gwt.xml file, actually one file is
enough.

The relationship among the project, gwt.xml files, html files,
entry-classes is:
1. One project only has one gwt.xml configuration files, you can
specify the gwt.xml in the compile.shell.
In you case, you can specify the the compile shell like this:
@java -cp "$src **/gwt-user.jar; **/gwt-dev-windows.jar"
com.google.gwt.dev.GWTCompiler -out "%~dp0\www" %* com.blah.DialogBox

2. One gwt.xml files may contain many entry-classes,
In you case, each entry-classes specify each DialogBox*.

3. One project may contain many html files, and each html file only
defines one entry-class in the meta tag.
In your case, you can specify the html1 to define DialogBox1 entry, and
html2 to define DialogBox2 entry.

manish

unread,
Aug 11, 2006, 4:09:54 PM8/11/06
to Google Web Toolkit
Hi all
Thanks for your help. I was finally able to figure this out:

a) a java Web application cans have multiple GWT Modules

b) each gwt module has to be compiled separately

c) a JSP page can 'host' a GWT widget by
i) ensuring that the module is refered to by the full path/module name
( as per Syed's earlier response)

ii) the script should also be referred by the full path

Regards
-manish

Reply all
Reply to author
Forward
0 new messages