在GWT app中的共享文件夹中进行验证

时间:2014-03-31 10:21:22

标签: java gwt

我是GWT的新手,我正在进行验证,以避免将患者重复插入数据库,我在共享端创建了一个类,并将所有用户从数据库加载到列表中并将其与新用户数据。

在共享方:

package de.chieukam.tutorial.shared;


import java.util.Date;
import java.util.List;

import de.chieukam.tutorial.server.PatientDAO;

public class PatientCreationValidation {

    private PatientDAO patientDAO;
    private boolean duplicate;

    public PatientCreationValidation(){

        this.patientDAO=new PatientDAO();
        this.duplicate=false;
    }


    public boolean checkDuplicatePatient(String name,String FirstName,Date date){

        List<PatientDTO> findAll=patientDAO.findAll();

        for(PatientDTO npatient:findAll){

            if(npatient.getLastName().equals(name)){

                duplicate=true;
                break;
            }


        }

        return duplicate;


    }
客户端

duplicatePatient= patientValidation.checkDuplicatePatient(textName.getText(), textFirstName.getText(), boxBirthday.getValue());

        if(duplicatePatient){
            GwtSpringHibernate.showAlertBox(" Patient Already Exists ");

            return;
        }

它给出错误

[ERROR] [GwtSpringHibernate] - Line 12: No source code is available for type de.chieukam.tutorial.server.PatientDAO; did you forget to inherit a required module?

[ERROR] [GwtSpringHibernate] - Unable to find type 'de.chieukam.tutorial.client.widgets.NewPatientDialog.AddiSelectWidgetUiBinder'

[ERROR] [GwtSpringHibernate] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

[ERROR] [GwtSpringHibernate] - Deferred binding failed for 'de.chieukam.tutorial.client.widgets.NewPatientDialog.AddiSelectWidgetUiBinder'; expect subsequent failures.

1 个答案:

答案 0 :(得分:1)

您不能在共享类中使用服务器端类

de.chieukam.tutorial.server.PatientDAO

以上行是共享方面的问题。

请在此处阅读GWT MVP atchitecture

在此处详细了解GWT Architectural Perspectives

阅读以下评论以获取更多信息。