2

GWT と SEAM を統合しようとしています。私は ドキュメントに従って、実行しようとしました

例を以下に示します。

  1. Eclipse Galileo を使用して GWT プロジェクトを作成し、例に示すようにクラスを作成しました。

  2. 次に、Seam 2.0.2 jar をビルド パスに追加しました。

  3. Eclipse UI を使用して Google GWT Compiler を使用して、アプリケーションをコンパイルしました。

  4. 最後に、アプリケーションを実行しました。

まず、上記の手順が正しいかどうかを知りたいです。アプリケーションを実行した後、目的の結果が得られません。

また、これが GWT と Seam を統合する唯一の方法ですか?

アップデート

この例は、ant を使用して実行しています。しかし、私の演習の目的は、Eclipse UI を介して実行することです。

GWTTest という名前で独自のプロジェクトを作成し、Eclipse で例を再作成しようとしました

UI。私が気づいたことがいくつかあります。Eclipse UI を介した GWT コンパイルは、war ファイル内に gwttest という名前のディレクトリを作成します。ant によって作成されるディレクトリ構造は異なります。

この例では、AskQuestionWidget getService 関数に次のようなコードがあります。

String endpointURL = GWT.getModuleBaseURL() + "seam/resource/gwt";

ディレクトリ構造に合わせてこのコードを変更するにはどうすればよいですか?

4

2 に答える 2

2

seam+richfaces+gwt を使用していますが、非常にうまく機能します。すべてmavenでビルドしていますが、antでもいいと思います。一般的な考え方は、Web アプリケーション全体を GWT 開発モードで開始することです。すべてをコンパイルする必要はありません (GWT コンパイラの場合は時間がかかります)。開発モードでは、要求されたリソースをオンデマンドでコンパイルします。このように GWT アプリケーションを実行することで、クライアント側のコードをデバッグすることもできます。

seam アクションに応答して GWT メソッドを呼び出すこともできます。

アップデート:

私たちのソリューションについて少し詳しく説明できます。

メイヴン

プロジェクトは で構成する必要がありますpackaging: war。maven (また、richfaces) を使用して seam を設定するための公式の指示がいくつかあります。

http://docs.jboss.org/seam/2.2.1.CR2/reference/en-US/html/dependencies.html#d0e34791

http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/SettingsForDifferentEnvironments.html

GWT の場合、次のセクションを に追加しますpom.xml

<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-user</artifactId>
  <version>2.1.0</version>
  <scope>provided</scope> <!-- prevents from including this in war -->
</dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-dev</artifactId>
  <version>2.1.0</version>
  <scope>provided</scope> <!-- prevents from including this in war -->
</dependency>
<dependency>
  <groupId>pl.ncdc.gwt</groupId>
  <artifactId>gwt-servlet-war</artifactId>
  <version>2.1.0</version>
  <type>war</type> <!-- adds gwt-servlet.jar to your war, but not to your classpath -->
</dependency>

<!-- build section -->
<build>
  <resources>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
    <resource>
      <directory>src/main/java</directory>
      <includes>
        <include>**/client/**/*.java</include>
        <include>**/client/**/*.properties</include>
        <include>**/shared/**/*.java</include>
        <include>**/shared/**/*.properties</include>
        <include>**/*.gwt.xml</include>
      </includes>
    </resource>
  </resources>
  <testResources>
    <testResource>
      <directory>src/test/java</directory>
      <includes>
        <include>**/client/**/*.java</include>
        <include>**/client/**/*.properties</include>
        <include>**/shared/**/*.java</include>
        <include>**/shared/**/*.properties</include>
        <include>**/*.gwt.xml</include>
      </includes>
    </testResource>
  </testResources>
<plugins>
  <plugin> <!-- dirty hack for GWT issue #3439 - it is not really fixed -->
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <id>remove-javax</id>
        <phase>compile</phase>
        <configuration>
          <tasks>
            <delete dir="${project.build.directory}/classes/javax" />
          </tasks>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>1.3.2.google</version>
    <configuration>
      <extraJvmArgs>-Xmx512M</extraJvmArgs>
      <gwtVersion>${gwt.version}</gwtVersion>
      <modules>
        <module>com.company.gwt.project.module.Module</module>
      </modules>
      <soyc>false</soyc>
      <draftCompile>${gwt.draft.compile}</draftCompile> <!-- you can control this with profiles -->
      <localWorkers>2</localWorkers><!-- in theory should speed things up on our quad CPU hudson -->
      <style>${gwt.style}</style> <!-- you can control this with profiles -->
    </configuration>
    <executions>
      <execution>
        <id>compile</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
      <execution>
        <id>gwt-test</id>
        <phase>integration-test</phase>
        <goals>
          <goal>test</goal>
        </goals>
        <configuration>
          <includes>**/*GwtTestSuite.java</includes>
        </configuration>
      </execution>
    </executions>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1</version>
    <configuration>
      <archiveClasses>true</archiveClasses>
      <warSourceDirectory>src/main/webapp-empty</warSourceDirectory> <!-- just empty dir for workaround -->
      <webResources>
        <resource>
          <directory>src/main/webapp</directory>
          <excludes>
            <exclude>app.*</exclude> <!-- name of you gwt module(s) - rename-to in gwt.xml -->
            <exclude>WEB-INF/web.xml</exclude>
          </excludes>
        </resource>
        <resource>
          <directory>src/main/webapp</directory>
          <includes>
            <include>WEB-INF/web.xml</include>
          </includes>
          <filtering>true</filtering>
        </resource>
      </webResources>
    </configuration>
  </plugin>
</plugins>
</build>

この構成では、seam と gwt の両方がコンパイルされた状態で war が発生するはずです。そのようなプロジェクトを開発モードで使用したい場合は、これも入れてくださいpom.xml

<dependency>
  <groupId>com.xemantic.tadedon</groupId>
  <artifactId>tadedon-gwt-dev</artifactId>
  <version>1.0-SNAPSHOT</version>
  <scope>provided</scope>
</dependency>

-server com.xemantic.tadedon.gwt.dev.JettyLauncherGoogle Web アプリケーション ランチャーに追加します。これは、状況によっては必要になる可能性のある Maven フレンドリーな桟橋ランチャーです。

お役に立てば幸いです。gwt と richfacaes アプリケーション間の通信に興味がありますか?

于 2010-09-10T18:39:18.920 に答える
0

必要に応じて、<SEAM_HOME>/examples/remoting/gwtを見てください。そこから実行します(使用する前にANTをインストールしてください)

ant

ここにそのreadme.txtファイルがあります

サンプルはhttp://localhost:8080/seam-helloworld/org.jboss.seam.example.remoting.gwt.HelloWorld/HelloWorld.htmlで見ることができます。

GWT: GWT フロント エンドを再構築する場合は、GWT をダウンロードし、それを指すように build.properties を構成する必要があります。その後、このディレクトリから「ant gwt-compile」を実行できます。デフォルトでビルド済みです。GWT ホスト モードを使用する場合は、GWT のドキュメントからすべてをお読みください。

于 2010-09-10T03:35:06.757 に答える