[英]jsf with Ajax having issues with mapping
我在管理器中有以下方法,該方法在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}" />
當我在管理器中檢查PatientData對象時,我得到的名字,姓氏和電話號碼的值沒有任何問題,管理器返回了數據
上面的JSP是包含在main.jsp中的include 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的值,這些值由manager中的PatientData對象返回
自一周以來嘗試解決此問題的任何幫助/指針將不勝感激
由於沒有在JSP中設置值,因此我沒有在Manager中執行以下操作
PatientInputTextField.setSubmittedValue(null); PatientFNameTextField.setSubmittedValue(null); PatientLNameTextField.setSubmittedValue(null); PatientPhoneNumTextField.setSubmittedValue(null);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.