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>
<!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.
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.
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