Have to click the button twice to invoke its action!!!!
I am using netbeans 5.5 visual web pack and tomcat server for my JSF project.
In one of my pages i have to click the submit button twice to invoke its action.
I searched forum for the answer but could not find any that could solve my problem.
Whenever i first click the button from the lifecycle listener class i used i found the application goes through following phases:
BeforePhase: RESTORE_VIEW 1
AfterPhase: RESTORE_VIEW 1
BeforePhase: APPLY_REQUEST_VALUES 2
com.sun.rave.web.ui.renderer.UploadRenderer::decode()
com.sun.rave.web.ui.renderer.UploadRenderer::Lookingfor id form1:citizenshipFileUPloadField_com.sun.rave.web.ui.upload
com.sun.rave.web.ui.renderer.UploadRenderer::Found id form1:citizenshipFileUPloadField_com.sun.rave.web.ui.upload
AfterPhase: APPLY_REQUEST_VALUES 2
BeforePhase: RENDER_RESPONSE 6
AfterPhase: RENDER_RESPONSE 6
There is no INVOKE_APPLICATION phase in first click. In second click, the status i got is:
BeforePhase: RESTORE_VIEW 1
AfterPhase: RESTORE_VIEW 1
BeforePhase: APPLY_REQUEST_VALUES 2
com.sun.rave.web.ui.renderer.UploadRenderer::decode()
com.sun.rave.web.ui.renderer.UploadRenderer::Lookingfor id form1:citizenshipFileUPloadField_com.sun.rave.web.ui.upload
com.sun.rave.web.ui.renderer.UploadRenderer::Found id form1:citizenshipFileUPloadField_com.sun.rave.web.ui.upload
AfterPhase: APPLY_REQUEST_VALUES 2
BeforePhase: PROCESS_VALIDATIONS 3
AfterPhase: PROCESS_VALIDATIONS 3
BeforePhase: UPDATE_MODEL_VALUES 4
AfterPhase: UPDATE_MODEL_VALUES 4
BeforePhase: INVOKE_APPLICATION 5
AfterPhase: INVOKE_APPLICATION 5
BeforePhase: RENDER_RESPONSE 6
AfterPhase: RENDER_RESPONSE 6
Now the INVOKE_APPLICATION phase is invoked.
I have <h:messages /> tag but no errors could be seen.
What can be the reasons behind this problem
# 2
[nobr]Well the code that is producing the problem is quite big. Anyway i will post it, hoope you can get something out of it.
The jsp page is:
<ui:body binding="#{ReceptionPage$CompanyPersonPage.body1}" id="body1" style="-rave-layout: grid">
<div align="center">
<ui:staticText binding="#{ReceptionPage$CompanyPersonPage.staticText1}" id="staticText1"
style="font-family: Georgia,'Times New Roman',times,serif; font-size: 18px; font-weight: bold" text="Company Person Page"/>
</div>
<div align="left" style="color:red;font-weight:bold;layout:table;">
<h:messages id="errMsgs"/>
</div>
<ui:form binding="#{ReceptionPage$CompanyPersonPage.form1}" id="form1">
<ul>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label1}" id="label1" style="" text="Citizenship Number:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.textField1}" id="textField1" required="true" style="" text="#{CompanyPersonBean.citizenshipNumber}"/>
</li>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label2}" id="label2" style="" text="Name:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.textField2}" id="textField2" required="true" style="" text="#{CompanyPersonBean.name}"/>
</li>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label3}" id="label3" style="" text="Country:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.textField3}" id="textField3" required="true" style="" text="#{CompanyPersonBean.country}"/>
</li>
<li>
<fieldset style="width:250px;float:left;">
<legend>Temporary Address</legend>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.tempDistrictLabel}" id="tempDistrictLabel" text="District:"/>
<br/>
<ui:dropDown binding="#{ReceptionPage$CompanyPersonPage.tempDistrictDropDown}"
converter="#{ReceptionPage$CompanyPersonPage.integerConverter1}" id="tempDistrictDropDown" immediate="true"
items="#{ReceptionPage$CompanyPersonPage.tempDistrictDataProvider.options['DISTRICT_ID,DISTRICT_NEPALI_NAME']}"
onChange="common_timeoutSubmitForm(this.form, 'ul:li:fieldset:tempDistrictDropDown');" valueChangeListener="#{ReceptionPage$CompanyPersonPage.tempDistrictDropDown_processValueChange}"/>
<br/>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.tempAreaLabel}" id="tempAreaLabel" text="Area(VDC/Municipality):"/>
<br/>
<ui:dropDown binding="#{ReceptionPage$CompanyPersonPage.tempAreaDropDown}"
converter="#{ReceptionPage$CompanyPersonPage.integerConverter3}" id="tempAreaDropDown" items="#{ReceptionPage$CompanyPersonPage.tempAreaDataProvider.options['AREA_ID,AREA_NEPALI_NAME']}"/>
<br/>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.tempWardNoLabel}" id="tempWardNoLabel" text="Ward No:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.tempWardNoTextField}" id="tempWardNoTextField" required="true"/>
<br/>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.tempHouseNoLabel}" id="tempHouseNoLabel" text="House No:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.tempHouseNoTextField}" id="tempHouseNoTextField"/>
</fieldset>
<fieldset style="width:250px;">
<legend>
Permanent Address</legend>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.permDistrictLabel}" id="permDistrictLabel" text="District:"/>
<br/>
<ui:dropDown binding="#{ReceptionPage$CompanyPersonPage.permDistrictDropDown}"
converter="#{ReceptionPage$CompanyPersonPage.integerConverter2}" id="permDistrictDropDown" immediate="true"
items="#{ReceptionPage$CompanyPersonPage.permDistrictDataProvider.options['DISTRICT_ID,DISTRICT_NEPALI_NAME']}"
onChange="common_timeoutSubmitForm(this.form, 'ul:li:fieldset:permDistrictDropDown');" valueChangeListener="#{ReceptionPage$CompanyPersonPage.permDistrictDropDown_processValueChange}"/>
<br/>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.permAreaLabel}" id="permAreaLabel" text="Area(VDC/Municipality):"/>
<br/>
<ui:dropDown binding="#{ReceptionPage$CompanyPersonPage.permAreaDropDown}"
converter="#{ReceptionPage$CompanyPersonPage.integerConverter4}" id="permAreaDropDown" items="#{ReceptionPage$CompanyPersonPage.permAreaDataProvider.options['AREA_ID,AREA_NEPALI_NAME']}"/>
<br/>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.permWardNoLabel}" id="permWardNoLabel" text="Ward No:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.permWardNoTextField}" id="permWardNoTextField" required="true"/>
<br/>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.permHouseNoLabel}" id="permHouseNoLabel" text="House No:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.permHouseNoTextField}" id="permHouseNoTextField"/>
</fieldset>
</li>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label4}" id="label4" style="" text="Phone Number:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.textField4}" id="textField4" style="" text="#{CompanyPersonBean.phoneNumber}"/>
</li>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label5}" id="label5" style="" text="Mobile:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.textField5}" id="textField5" style="" text="#{CompanyPersonBean.mobileNumber}"/>
</li>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label6}" id="label6" style="" text="Email:"/>
<br/>
<ui:textField binding="#{ReceptionPage$CompanyPersonPage.textField6}" id="textField6" style=""
text="#{CompanyPersonBean.emailAddress}" validator="#{ReceptionPage$CompanyPersonPage.textField6_validate}"/>
</li>
<li>
<b>Person Company Relation:</b>
<br/>
<ui:checkbox binding="#{ReceptionPage$CompanyPersonPage.checkbox1}" id="checkbox1" label="Is Promoter" style=""/>
<br/>
<ui:checkbox binding="#{ReceptionPage$CompanyPersonPage.checkbox2}" id="checkbox2" label="Is Board Oof Director" style=""/>
<br/>
<ui:checkbox binding="#{ReceptionPage$CompanyPersonPage.checkbox3}" id="checkbox3" label="Is Shareholder" style=""/>
<br/>
<br/>
</li>
<li>
<ui:label binding="#{ReceptionPage$CompanyPersonPage.label7}" id="label7" style="" text="Citizenship Certificate File"/>
<br/>
<ui:upload binding="#{ReceptionPage$CompanyPersonPage.citizenshipFileUPloadField}"
columns="#{CompanyPersonBean.citizenshipFilePath}" id="citizenshipFileUPloadField" required="true" style=""/>
</li>
<li>
<ui:button action="#{ReceptionPage$CompanyPersonPage.button1_action}" binding="#{ReceptionPage$CompanyPersonPage.button1}"
id="button1" style="height: 23px"
text="Save"/>
||
<ui:button
binding="#{ReceptionPage$CompanyPersonPage.button2}" id="button2" onClick="window.close()" style="height: 24px" text="Close"/>
</li>
</ul>
</ui:form>
</ui:body>
The corresponding bean is:
public class CompanyPerson {
private String citizenshipNumber;
private String name;
private String country;
private String phoneNumber;
private String mobileNumber;
private String emailAddress;
private String citizenshipFilePath;
private String isShareHolder;
private String isBoardOfDirector;
private String isPromoter;
public CompanyPerson() {
}
public String getCitizenshipNumber() {
return citizenshipNumber;
}
public void setCitizenshipNumber(String citizenshipNumber) {
this.citizenshipNumber = citizenshipNumber;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getMobileNumber() {
return mobileNumber;
}
public void setMobileNumber(String mobileNumber) {
this.mobileNumber = mobileNumber;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public int getTemporaryAddressId() {
return temporaryAddressId;
}
public void setTemporaryAddressId(int temporaryAddressId) {
this.temporaryAddressId = temporaryAddressId;
}
public int getPermanentAddressId() {
return permanentAddressId;
}
public void setPermanentAddressId(int permanentAddressId) {
this.permanentAddressId = permanentAddressId;
}
public String getCitizenshipFilePath() {
return citizenshipFilePath;
}
public void setCitizenshipFilePath(String citizenshipFilePath) {
this.citizenshipFilePath = citizenshipFilePath;
}
public String getIsShareHolder() {
return isShareHolder;
}
public void setIsShareHolder(String isShareHolder) {
this.isShareHolder = isShareHolder;
}
public String getIsBoardOfDirector() {
return isBoardOfDirector;
}
public void setIsBoardOfDirector(String isBoardOfDirector) {
this.isBoardOfDirector = isBoardOfDirector;
}
public String getIsPromoter() {
return isPromoter;
}
public void setIsPromoter(String isPromoter) {
this.isPromoter = isPromoter;
}
}
No all the properties of the bean has been bind to components.
I also have value change listener methods for two drop down lists whose immediate property is set to true to bypass the validation. If i change the dropdownlist selection then its value change listener method is successfully invoked, then after if i click the submit button, then it will works.[/nobr]