我在管理器中有以下方法,在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}" />
当我检查managerI中的patientData对象时,获取firstName,lastName&amp;的值。没有任何问题的phonenumber数据已由经理返回
上面的JSP是一个包含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>
现在我无法呈现managerI中clientData对象返回的firstName,lastName和phoneNumber的值
任何有关解决此问题的帮助/指示都会受到赞赏,尝试解决此问题,因为现在已经过了一周
答案 0 :(得分:0)
我没有在Manager中执行以下操作,因为JSP中没有设置值
patientInputTextField.setSubmittedValue(空); patientFNameTextField.setSubmittedValue(NULL); patientLNameTextField.setSubmittedValue(NULL); patientPhoneNumTextField.setSubmittedValue(NULL);