0

Here is my Code which i am try in jsf 2.0 project.

  1. <h:input value="#{studentInfoBean.registrationFormNo}" id="registrationFormId"/>
  2. <h:commandButton type="submit"
    actionListener="# {studentInfoBean.searchStudentbyformNo}">
    <f:ajax execute="registrationFormId" render="testlist" />
    </h:commandButton>

when i enter a value in input field then click on commandButton so its give a result from the bean my bean name is studentInfobean SessionScoped. my question is that when input field is blank then click on commandbutton so bean is not called so i did not get any response my pervious result remain as it is.

Thanks

Johny T Koshy
  • 3,857
  • 2
  • 23
  • 40
  • Use to check whether a conversion or validation error occurs. – Johny T Koshy Jul 04 '13 at 11:08
  • Hello Johny I use this one but no validation error same result – Tapan singh kushwaha Jul 04 '13 at 11:20
  • Can anybody help me out ? – Tapan singh kushwaha Jul 04 '13 at 11:51
  • Please add the code for your `searchStudentbyformNo` method. My take is that you didn't re-initiate the result objects when input is null of empty. Hence, the old result remains. – Mr.J4mes Jul 04 '13 at 12:23
  • public String searchStudentbyformNo(){ final FacesContext facesContext = FacesContext.getCurrentInstance(); HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); System.out.println(" this.getRegistrationFormNo()--------->"+this.getRegistrationFormNo()); StudentRegistration studentRegistration = ServiceLocater.getStudentServices().getstudentregistrationFormNo(this.getRegistrationFormNo()); if(studentRegistration == null){ this.setMessageabc(" Record not found") } if(studentRegistration !=null){ this.setMessageabc("found"); } return ""; } – Tapan singh kushwaha Jul 04 '13 at 12:55
  • I already check for null or empty but this.getRegistrationFormNo(); not giving null or empty this searchStudentbyFormNo method not at all called by click on commandbutton – Tapan singh kushwaha Jul 04 '13 at 12:56
  • When Input field is blank – Tapan singh kushwaha Jul 04 '13 at 13:01
  • Please work through http://stackoverflow.com/questions/2118656/hcommandlink-hcommandbutton-is-not-being-invoked/2120183#2120183 – BalusC Jul 04 '13 at 15:39

0 Answers0