I have two selectBooleanCheckbox in my
jsp When the value of the checkboxes is true when the page is loaded from the database then for some reason when the checkbox1 is clicked the valueChangeListener of the second checkbox is called.
< h:selectBooleanCheckbox id="loginDurationRestrictionFlag" value="#{securityProfile.loginDurationRestrictionFlag}" immediate="true" valueChangeListener="#{securityProfile.enableDates}" />
there is an on click of this checkbox written which submits the page.
( not able to write it here the topic isnt getting posted )
< h:selectBooleanCheckbox id="passwordNeverExpiresFlag" value="#{securityProfile.passwordNeverExpiresFlag}" immediate="true" valueChangeListener="#{securityProfile.enableExpiryDays}"/>
also an on click here which submits the page
when the loginDurationRestrictionFlag value returns true and the data is loaded on the page the checkbox shows checked but on clicked it calls the enableExpiryDays method. the reverse happens if the passwordNeverExpiresFlag is checked when the page loads and the passwordNeverExpiresFlag is clicked on the enableDates is called. However there does not seem to be a problem once the page is loaded with any value false.
public boolean getLoginDurationRestrictionFlag() {
if (securityProfileDataBean.getLoginDurationRestrictionFlag() == null
|| securityProfileDataBean.getLoginDurationRestrictionFlag()
.equals("N"))
return false;
return true;
}
public void setLoginDurationRestrictionFlag(boolean loginDurationRestFlag) {
if (loginDurationRestFlag)
this.securityProfileDataBean.setLoginDurationRestrictionFlag("Y");
else
this.securityProfileDataBean.setLoginDurationRestrictionFlag("N");
}
public boolean getPasswordNeverExpiresFlag() {
if (securityProfileDataBean.getPasswordNeverExpiresFlag() == null
|| securityProfileDataBean.getPasswordNeverExpiresFlag()
.equals("N"))
return false;
return true;
}
public void setPasswordNeverExpiresFlag(boolean pwdNeverExpiresFlag) {
if (pwdNeverExpiresFlag)
this.securityProfileDataBean.setPasswordNeverExpiresFlag("Y");
else
this.securityProfileDataBean.setPasswordNeverExpiresFlag("N");
}
I can not figure out what i am doing wrong.
Another thing i noticed is that after clicking any of the boxes preloaded with true once the other works when clicked.
Another thing that i forgot to mention
The primary key is being entered from helloworld.jsp(#{securityProfile.securityProfileDataBean.profileID}) and a button is pressed whose action is defined by #{securityProfile.addMode}
this method returns 'success' which then goes to the SecurityProfile.jsp
public
String getData()
{
if(this.securityProfileDataBean.getProfileID() !=null)
{
SecurityProfileDAOImpl as = new SecurityProfileDAOImpl();
this.securityProfileDataBean = as.getSecurityProfile(this.securityProfileDataBean.getProfileID());
return "success";
}
return "failure";
}
I added a System.out.println() in one of the getters and found that it gets called when the page gets displayed when the getData is called from getData(). The System.out.println() gets displayed again when that page is submitted again via the valueChangeListener but doesnt get displayed on the second submission. So i figure i have missed something but what i can not figure it out.
[ July 13, 2006: Message edited by: Sandip Chaudhuri ]
[ July 14, 2006: Message edited by: Sandip Chaudhuri ]