私はjsfページの患者IDテキストフィールドのぼかしで呼び出されるマネージャに次のメソッドを持っています
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}" />
マネージャーでpatientDataオブジェクトをチェックすると、問題なくfirstName、lastName、およびphonenumberの値が取得され、マネージャーからデータが返されました
上記の JSP は、main.jsp にインクルードされたインクルード Jsp (info.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>
今、マネージャーの患者データ オブジェクトによって返される firstName、lastName、および phoneNumber の値をレンダリングできません。
これを解決するためのヘルプ/ポインターは、1週間前からこれを解決しようとしていただければ幸いです