0

我在管理器中有以下方法,该方法在 jsf 页面上的 patientId 文本字段的模糊中调用

private Patient patientData; //also have get and set 

public void search(ActionEvent actionEvent){
                 String aPatientId   = (String)getPatientInputTextField().getSubmittedValue();
                 Session s = null;
              try{
               s = HibernateUtil.getSession();
               StringBuffer sql =new StringBuffer("  from Patient p ");
               if(!(aPatientId == null || aPatientId.length() ==0 )){
                sql.append(where);
                sql.append(" p.pid=:patientId ");
                pidflag=true;
               }
               Query qList1 = s.createQuery(sql.toString());
               Integer patientId = aPatientId == null || aPatientId.length() == 0? 0 : Integer.valueOf(aPatientId);
               qList1.setInteger("patientId", patientId);
               int size = qList1.list().size();
               if(size > 0 ){
                 patientData = (Patient)qList1.list().get(0);
               }else if(size ==0 ){
                 System.err.println("NO MATCH FOUND");
                }
             }catch(Exception exception){
                 exception.printStackTrace();
             }
    }

我在 JSF 中有以下代码

<t:inputText id="patientId" binding="#{Manager.patientInputTextField}" 
        value="#{patient.pid}" readonly="#{readonly}">

<a4j:support event = "onblur" immediate="true"
         actionListener = "#{Manager.search}"  reRender = "firstName,lastName,phoneNum"/>
</t:inputText>
<t:inputText id='lastName'  value="#{patient.lastName}" />
<t:inputText id='firstName' value="#{patient.firstName}"/>
<t:inputText id='phoneNum'  value="#{patient.phoneNum}" />

当我检查 manager 中的 patientData 对象时,我得到了 firstName、lastName 和 phonenumber 的值,没有任何问题,数据由经理返回

上面的 JSP 是一个 include Jsp(info.jsp),它被包含在 main.jsp 中

<f:view>
<h:messages ></h:messages>
<body>
<h:form id="headerinclude">
    <t:aliasBeansScope>
        <t:aliasBean alias="#{patient}" value="#{Manager.patientData}" />
          <f:subview id="billingView">
            <%@ include file="info.jsp"%>
          </f:subview>
    </t:aliasBeansScope>

现在我无法呈现由 manager 中的 patientData 对象返回的 firstName、lastName 和 phoneNumber 的值

任何解决此问题的帮助/指示将不胜感激,因为一周后尝试解决此问题

4

1 回答 1

0

由于未在 JSP 中设置值,我没有在 Manager 中执行以下操作

patientInputTextField.setSubmittedValue(null); 患者FNameTextField.setSubmittedValue(null); 患者LNameTextField.setSubmittedValue(null); patientPhoneNumTextField.setSubmittedValue(null);

于 2011-03-04T03:45:15.540 回答