0

GWT 2.5 を使用しています。gwt-rpc を使用するアプリケーションがあります。プロジェクトをコンパイルし、ant スクリプトを使用して war ファイルを作成しました。プロジェクトをTomcatにデプロイすると、プロジェクトは正常にロードされますが、コントロールは表示されません。単純な空白の HTML ページです。ここに私のファイルがあります。モジュール

<?xml version="1.0" encoding="UTF-8"?>
<!--
  When updating your version of GWT, you should also update this DTD reference,
  so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
  "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='interviewscheduler'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->
  <inherits name="com.smartgwt.SmartGwt"/>
  <!-- Specify the app entry point class.                         -->
  <entry-point class='interviewscheduler.client.InterViewScheduler'/>

  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>

</module>

リモートサービス

package interviewscheduler.client;

import interviewscheduler.shared.Interview;
import interviewscheduler.shared.Teacher;

import java.util.LinkedHashMap;
import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("interviewScheduler")
public interface InterviewSchedulerService extends RemoteService{
    Boolean loadStudentData() throws IllegalArgumentException;
    Boolean loadParentData() throws IllegalArgumentException;
    Boolean loadTeacherData() throws IllegalArgumentException;
    Boolean loadClassData() throws IllegalArgumentException;
    Boolean loadClassMemberShipData() throws IllegalArgumentException;
    Boolean loadRoomData() throws IllegalArgumentException;
    Boolean loadSessionData() throws IllegalArgumentException;
    Boolean loadInterviewData() throws IllegalArgumentException;
    LinkedHashMap<String, String> getStudentNames() throws IllegalArgumentException;
    String getParentName(String studentKey) throws IllegalArgumentException;
    List<Teacher> getAvailableTeachers(String studentKey) throws IllegalArgumentException;
    List<Teacher> getRequestedTeachers(String studentKey) throws IllegalArgumentException;
    List<Interview> getInterviewByStudent(String studentKey) throws IllegalArgumentException;
    List<Interview> getInterviewByTeacher(String teacherCode) throws IllegalArgumentException;
    List<Object> getInterviewsForGrid(List<Interview> list) throws IllegalArgumentException;
    String addInterview(Interview obj) throws IllegalArgumentException;
    String removeInterview(String studentId, String teacherId) throws IllegalArgumentException;
}

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

  <!-- Servlets -->

  <servlet>
    <servlet-name>interviewSchedulerServlet</servlet-name>
    <servlet-class>interviewscheduler.server.InterviewSchedulerServiceImpl</servlet-class>
  </servlet>

   <servlet-mapping>
    <servlet-name>interviewSchedulerServlet</servlet-name>
    <url-pattern>/interviewscheduler/interviewScheduler</url-pattern>
  </servlet-mapping>
  <!-- Default page to serve -->

  <welcome-file-list>
    <welcome-file>InterViewScheduler.html</welcome-file>
  </welcome-file-list>

</web-app>

私が間違っていることは何ですか?緊急です。

package interviewscheduler.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.smartgwt.client.widgets.layout.VLayout;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class InterViewScheduler implements EntryPoint {
    /**
     * This is the entry point method.
     */
    private InterviewSchedulerServiceAsync remoteObject=GWT.create(InterviewSchedulerService.class);
    private VLayout wrapper=new VLayout();
    private VLayout headerArea=new Header();
    private VLayout contentArea=new ContentArea();

    public void onModuleLoad() {
        Window.enableScrolling(true);
        Window.setMargin("0px");
        remoteObject.loadStudentData(new AsyncCallback<Boolean>() {
            @Override
            public void onSuccess(Boolean result) {

            RootLayoutPanel.get().add(drawWrapper());
            }
            @Override
            public void onFailure(Throwable caught) {
                System.out.println("Failed*****************");
            }
        });


    }

    /** 
     * initialize the wrapper of the web site which holds all other content------Main Container 
     */

    public VLayout drawWrapper(){
        wrapper.setWidth100();
        wrapper.setHeight100();
        wrapper.setMargin(0);
        wrapper.addMember(drawHeaderArea());
        wrapper.addMember(drawContentArea());
        return wrapper;
    }
    /** 
     * initialize the Header Area of the web site which contains Logo with Title and a logout button
     */
    public VLayout drawHeaderArea(){
        headerArea.redraw();
        return headerArea;
    }

    /** 
     * initialize the Content Area of the web site which holds a main TabSet
     */

    public VLayout drawContentArea(){
        contentArea.redraw();
        return contentArea;
    }

}
4

2 に答える 2

0

アプリケーションで何らかの方法でデータを表示する必要があります。あなたが今しているのは、たくさんのサービスを呼び出すことだけです。それは実際にはかなり混乱しています。サーバーへの1回の呼び出しですべてを実行する必要があります。それはあなたにたくさんの往復を節約し、そしておそらくあなたがいくつかの失敗した電話を持つことからあなたを救うでしょう。

于 2013-02-12T18:16:35.243 に答える
0

ばかげた間違い...必要なライブラリを WEB-INF/lib ディレクトリに含めていません。これにより、RPC 呼び出しが失敗します。いずれかの方法。Enryboに感謝します。デバッグテクニックはとても役に立ちます。

于 2013-02-14T11:02:20.923 に答える