3 Replies Latest reply on Mar 5, 2009 2:44 AM by skumarsamy

    rich:moalpanel with managed-bean property

    skumarsamy

      Hi,

      I'm new to richfaces and jsf.
      I have did some exploration and developed one page which shows user details, which includes another page which is UI:included this page show the user's security information

      I have SecurityManger the control bean, which holds SystemUser bean as property, which in turn holds SecurityInfo bean as its property. My problem is when securityinfo insert action invoked throws null with my values, i tried many waysif i try to invoke the insert action second time the data gets inserted.

      I'm posting the whole set here

      Here is my manager bean class

      package com.radlink.eris.systemuser.manager;
      
      import java.util.ArrayList;
      import java.util.Date;
      import java.util.List;
      import java.util.Map;
      
      import javax.faces.event.ActionEvent;
      import javax.faces.model.SelectItem;
      
      import org.ajax4jsf.component.html.HtmlAjaxCommandButton;
      import org.richfaces.component.UIDataList;
      
      import com.radlink.eris.common.bean.BeanHelper;
      import com.radlink.eris.common.entity.ERISBase;
      import com.radlink.eris.common.entity.ERISWebBase;
      import com.radlink.eris.common.manager.ContactManager;
      import com.radlink.eris.common.master.entity.LookupDetail;
      import com.radlink.eris.core.exception.GenericDaoException;
      import com.radlink.eris.core.exception.GenericManagerException;
      import com.radlink.eris.core.manager.ERISApplicationManager;
      import com.radlink.eris.core.manager.IWebManager;
      import com.radlink.eris.core.resources.IMessages;
      import com.radlink.eris.systemuser.dao.ISecurityInfoDAO;
      import com.radlink.eris.systemuser.dao.ISystemUserDAO;
      import com.radlink.eris.systemuser.entity.SecurityInfo;
      import com.radlink.eris.systemuser.entity.SystemUser;
      
      public class SystemUserManager extends ERISWebBase implements IWebManager {
      
       private SystemUser systemUser;
       private List<SystemUser> systemUsers;
      
       private List<LookupDetail> countries;
       private List<LookupDetail> userTypes;
       private List<LookupDetail> userDepartments;
       private List<LookupDetail> userTitles;
       private List<LookupDetail> employmentTypes;
       private List<LookupDetail> addressTypes;
       private List<LookupDetail> passwdQuestionTypes;
       private List<SelectItem> countryOptions = new ArrayList<SelectItem>();
       private List<SelectItem> userTypeOptions = new ArrayList<SelectItem>();
       private List<SelectItem> userDepartmentOptions = new ArrayList<SelectItem>();
       private List<SelectItem> userTitleOptions = new ArrayList<SelectItem>();
       private List<SelectItem> employmentTypeOptions = new ArrayList<SelectItem>();
       private List<SelectItem> addressTypeOptions = new ArrayList<SelectItem>();
       private List<SelectItem> passwdQuestionTypeOptions = new ArrayList<SelectItem>();
       private String[] lookupNames = { "Country", "User Type", "User Department",
       "Employment Type", "Title", "Password Question Type" };
      
       ContactManager contactManager;
       SecurityManager securityManager;
      
       private boolean userEditable = false;
       private boolean userSecurityEditable = false;
       private UIDataList usersTable;
       private HtmlAjaxCommandButton userUpdateLink;
       private HtmlAjaxCommandButton userSecurityUpdateLink;
      
       ISystemUserDAO systemUserDao;
       ISecurityInfoDAO securityDao;
      
       public SystemUserManager() throws GenericManagerException {
       try {
       systemUser = new SystemUser();
       systemUser.setSecurityInfo(new SecurityInfo());
       systemUser.getSecurityInfo().init();
       systemUserDao = BeanHelper.getSystemUserDAO();
       securityDao = BeanHelper.getSecurityInfoDAO();
       systemUsers = systemUserDao
       .getSystemUsers(ERISBase.TEST_ORGNIZATIONID);
       initLookups();
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
      
       @SuppressWarnings("unchecked")
       public void initLookups() throws GenericManagerException {
       Map lookupDetailMap = ERISApplicationManager
       .GetApplicationLookupOptions(lookupNames);
       if (lookupDetailMap != null) {
       Map<String, List<LookupDetail>> lookupDetailsMap = (Map<String, List<LookupDetail>>) lookupDetailMap
       .get(ERISApplicationManager.MAP_LOOKUP);
       Map<String, List<SelectItem>> lookupDetailsOptionMap = (Map<String, List<SelectItem>>) lookupDetailMap
       .get(ERISApplicationManager.MAP_LOOKUP_OPTIONS);
       for (String lookupName : lookupNames) {
       logger.info("Lookup Map: " + lookupDetailsMap.size() + ":"
       + lookupDetailsOptionMap.size());
       logger.info("SystemUser UI Lookup: " + lookupName);
       if ("Country".equals(lookupName)) {
       countries = (List<LookupDetail>) lookupDetailsMap
       .get(lookupName);
       countryOptions = lookupDetailsOptionMap.get(lookupName
       + "Options");
       logger.info("SystemUser UI Lookup: " + lookupName + ":"
       + countries.size());
       } else if ("User Type".equals(lookupName)) {
       userTypes = (List<LookupDetail>) lookupDetailsMap
       .get(lookupName);
       userTypeOptions = lookupDetailsOptionMap.get(lookupName
       + "Options");
       logger.info("SystemUser UI Lookup: " + lookupName + ":"
       + userTypes.size());
       } else if ("User Department".equals(lookupName)) {
       userDepartments = (List<LookupDetail>) lookupDetailsMap
       .get(lookupName);
       userDepartmentOptions = lookupDetailsOptionMap
       .get(lookupName + "Options");
       logger.info("SystemUser UI Lookup: " + lookupName + ":"
       + userDepartments.size());
       } else if ("Employment Type".equals(lookupName)) {
       employmentTypes = (List<LookupDetail>) lookupDetailsMap
       .get(lookupName);
       employmentTypeOptions = lookupDetailsOptionMap
       .get(lookupName + "Options");
       logger.info("SystemUser UI Lookup: " + lookupName + ":"
       + employmentTypes.size());
       } else if ("Title".equals(lookupName)) {
       userTitles = (List<LookupDetail>) lookupDetailsMap
       .get(lookupName);
       userTitleOptions = lookupDetailsOptionMap.get(lookupName
       + "Options");
       logger.info("SystemUser UI Lookup: " + lookupName + ":"
       + userTitles.size());
       } else if ("Password Question Type".equals(lookupName)) {
       passwdQuestionTypes = (List<LookupDetail>) lookupDetailsMap
       .get(lookupName);
       passwdQuestionTypeOptions = lookupDetailsOptionMap
       .get(lookupName + "Options");
       }
       }
       }
       }
      
       public void cancelAction(ActionEvent e) throws GenericManagerException {
       logger.info("Cancelling Edit");
       this.CURRENT_ACTION = CANCEL_ACTION;
       this.clearFields();
       try {
       systemUsers = systemUserDao
       .getSystemUsers(ERISBase.TEST_ORGNIZATIONID);// TODO
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
      
       public void clearFields() {
       logger.info("Cancelling Edit");
       systemUser.reset();
       setUserEditable(false);
       userUpdateLink.setRendered(false);
       }
      
       public Object collectFormData() throws GenericManagerException {
       SystemUser sysUsr = new SystemUser();
       if (UPDATE_ACTION.equals(CURRENT_ACTION)) {
       sysUsr.setOrganizationId(systemUser.getOrganizationId());
       sysUsr.setUserId(systemUser.getUserId());
       sysUsr.setCreatedBy(systemUser.getCreatedBy());
       sysUsr.setCreatedDate(systemUser.getCreatedDate());
       }
       sysUsr.setUserType(systemUser.getUserType());
       sysUsr.setDepartmentId(systemUser.getDepartmentId());
       sysUsr.setTitle(systemUser.getTitle());
       sysUsr.setFirstName(systemUser.getFirstName());
       sysUsr.setLastName(systemUser.getLastName());
       sysUsr.setNric(systemUser.getNric());
       sysUsr.setDesignation(systemUser.getDesignation());
       sysUsr.setDateOfBirth(systemUser.getDateOfBirth());
       sysUsr.setGender(systemUser.getGender());
       sysUsr.setMarkDeleted(systemUser.isDeleted() ? 1 : 0);
       return sysUsr;
       }
      
       public void deleteAction(ActionEvent e) throws GenericManagerException {
       try {
       logger.info("Deleting");
       this.CURRENT_ACTION = DELETE_ACTION;
       systemUserDao.deleteSystemUser(systemUser);
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
      
       public void editAction(ActionEvent e) throws GenericManagerException {
       logger.info("Editing");
       this.CURRENT_ACTION = EDIT_ACTION;
       setRowDataToForm();
       setUserEditable(true);
       userUpdateLink.setRendered(true);
       }
      
       public void editSecurityAction(ActionEvent e)
       throws GenericManagerException {
       logger.info("Security Editing: " + systemUser.getSecurityInfo());
       }
      
       public void insertAction(ActionEvent e) throws GenericManagerException {
       try {
       logger.info("Inserting");
       CURRENT_ACTION = INSERT_ACTION;
       SystemUser sysUsr = (SystemUser) collectFormData();
       sysUsr.setOrganizationId(ERISBase.TEST_ORGNIZATIONID);// TODO
       sysUsr.setCreatedBy(ERISBase.TEST_USERID); // TODO
       sysUsr.setCreatedDate(new Date(System.currentTimeMillis()));
       sysUsr.setLastUpdatedBy(ERISBase.TEST_USERID); // TODO
       sysUsr.setLastUpdatedDate(new Date(System.currentTimeMillis()));
       logger.info("Inserting " + sysUsr);
       int userId = systemUserDao.insertSystemUser(sysUsr);
       sysUsr.setUserId(userId);
       clearFields();
       systemUsers = systemUserDao
       .getSystemUsers(ERISBase.TEST_ORGNIZATIONID);// TODO
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
      
       public void refreshAction(ActionEvent e) throws GenericManagerException {
      
       }
      
       public void setRowDataToForm() throws GenericManagerException {
       logger.info("Setting Form fields");
       systemUser = (SystemUser) usersTable.getRowData();
       if (systemUser != null) {
       try {
       SecurityInfo secInfo = securityDao.getUserSecurityInfo(
       systemUser.getOrganizationId(), systemUser.getUserId(),
       systemUser.getObjectType());
       if (secInfo != null) {
       systemUser.setSecurityInfo(secInfo);
       setUserSecurityEditable(true);
       userSecurityUpdateLink.setRendered(true);
       } else {
       systemUser.setSecurityInfo(new SecurityInfo());
       systemUser.getSecurityInfo().init();
       setUserSecurityEditable(false);
       userSecurityUpdateLink.setRendered(false);
       }
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
       }
      
       public void updateAction(ActionEvent e) throws GenericManagerException {
       try {
       logger.info("Updating");
       CURRENT_ACTION = UPDATE_ACTION;
       SystemUser usr = (SystemUser) collectFormData();
       usr.setLastUpdatedBy(ERISBase.TEST_USERID);
       usr.setLastUpdatedDate(new Date(System.currentTimeMillis()));
       logger.info(usr);
       systemUserDao.updateSystemUser(usr);
       this.userUpdateLink.setRendered(false);
       systemUsers = systemUserDao.getSystemUsers(usr.getOrganizationId());
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
      
       public SystemUser getSystemUser() {
       return systemUser;
       }
      
       public void setSystemUser(SystemUser systemUser) {
       this.systemUser = systemUser;
       }
      
       public List<SystemUser> getSystemUsers() {
       return systemUsers;
       }
      
       public void setSystemUsers(List<SystemUser> systemUsers) {
       this.systemUsers = systemUsers;
       }
      
       public boolean isUserEditable() {
       return userEditable;
       }
      
       public void setUserEditable(boolean userEditable) {
       this.userEditable = userEditable;
       }
      
       public boolean isUserSecurityEditable() {
       return userSecurityEditable;
       }
      
       public void setUserSecurityEditable(boolean userSecurityEditable) {
       this.userSecurityEditable = userSecurityEditable;
       }
      
       public UIDataList getUsersTable() {
       return usersTable;
       }
      
       public void setUsersTable(UIDataList usersTable) {
       this.usersTable = usersTable;
       }
      
       public HtmlAjaxCommandButton getUserUpdateLink() {
       return userUpdateLink;
       }
      
       public void setUserUpdateLink(HtmlAjaxCommandButton userUpdateLink) {
       this.userUpdateLink = userUpdateLink;
       }
      
       public HtmlAjaxCommandButton getUserSecurityUpdateLink() {
       return userSecurityUpdateLink;
       }
      
       public void setUserSecurityUpdateLink(
       HtmlAjaxCommandButton userSecurityUpdateLink) {
       this.userSecurityUpdateLink = userSecurityUpdateLink;
       }
      
       public List<LookupDetail> getCountries() {
       return countries;
       }
      
       public void setCountries(List<LookupDetail> countries) {
       this.countries = countries;
       }
      
       public List<LookupDetail> getUserTypes() {
       return userTypes;
       }
      
       public void setUserTypes(List<LookupDetail> userTypes) {
       this.userTypes = userTypes;
       }
      
       public List<LookupDetail> getUserDepartments() {
       return userDepartments;
       }
      
       public void setUserDepartments(List<LookupDetail> userDepartments) {
       this.userDepartments = userDepartments;
       }
      
       public List<LookupDetail> getEmploymentTypes() {
       return employmentTypes;
       }
      
       public void setEmploymentTypes(List<LookupDetail> employmentTypes) {
       this.employmentTypes = employmentTypes;
       }
      
       public List<LookupDetail> getAddressTypes() {
       return addressTypes;
       }
      
       public void setAddressTypes(List<LookupDetail> addressTypes) {
       this.addressTypes = addressTypes;
       }
      
       public List<SelectItem> getCountryOptions() {
       return countryOptions;
       }
      
       public void setCountryOptions(List<SelectItem> countryOptions) {
       this.countryOptions = countryOptions;
       }
      
       public List<SelectItem> getUserTypeOptions() {
       return userTypeOptions;
       }
      
       public void setUserTypeOptions(List<SelectItem> userTypeOptions) {
       this.userTypeOptions = userTypeOptions;
       }
      
       public List<SelectItem> getUserDepartmentOptions() {
       return userDepartmentOptions;
       }
      
       public void setUserDepartmentOptions(List<SelectItem> userDepartmentOptions) {
       this.userDepartmentOptions = userDepartmentOptions;
       }
      
       public List<SelectItem> getEmploymentTypeOptions() {
       return employmentTypeOptions;
       }
      
       public void setEmploymentTypeOptions(List<SelectItem> employmentTypeOptions) {
       this.employmentTypeOptions = employmentTypeOptions;
       }
      
       public List<SelectItem> getAddressTypeOptions() {
       return addressTypeOptions;
       }
      
       public void setAddressTypeOptions(List<SelectItem> addressTypeOptions) {
       this.addressTypeOptions = addressTypeOptions;
       }
      
       public List<LookupDetail> getUserTitles() {
       return userTitles;
       }
      
       public void setUserTitles(List<LookupDetail> userTitles) {
       this.userTitles = userTitles;
       }
      
       public List<SelectItem> getUserTitleOptions() {
       return userTitleOptions;
       }
      
       public void setUserTitleOptions(List<SelectItem> userTitleOptions) {
       this.userTitleOptions = userTitleOptions;
       }
      
       public List<LookupDetail> getPasswdQuestionTypes() {
       return passwdQuestionTypes;
       }
      
       public void setPasswdQuestionTypes(List<LookupDetail> passwdQuestionTypes) {
       this.passwdQuestionTypes = passwdQuestionTypes;
       }
      
       public List<SelectItem> getPasswdQuestionTypeOptions() {
       return passwdQuestionTypeOptions;
       }
      
       public void setPasswdQuestionTypeOptions(
       List<SelectItem> passwdQuestionTypeOptions) {
       this.passwdQuestionTypeOptions = passwdQuestionTypeOptions;
       }
      
       public void securityInfoAction(ActionEvent e)
       throws GenericManagerException {
       }
      
       public void insertSecurityAction(ActionEvent e)
       throws GenericManagerException {
       try {
       logger.info("Inserting Security Info");
       CURRENT_ACTION = INSERT_DETAIL_ACTION;
       SecurityInfo secInfo = (SecurityInfo) collectSecurityFormData();
       secInfo.setCreatedBy(ERISBase.TEST_USERID); // TODO
       secInfo.setCreatedDate(new Date(System.currentTimeMillis()));
       secInfo.setLastUpdatedBy(ERISBase.TEST_USERID); // TODO
       secInfo.setLastUpdatedDate(new Date(System.currentTimeMillis()));
       logger.info("Inserting " + secInfo);
       int userSecId = securityDao.insertUserSecurityInfo(secInfo);
       secInfo.setSecurityInfoId(userSecId);
       } catch (GenericDaoException exp) {
       throw new GenericManagerException(exp.getMessage(), exp
       .getErrorCode(), exp, exp.getParameterValues());
       } catch (Exception exp) {
       throw new GenericManagerException(exp.getMessage(),
       IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
       }
       }
      
       public void updateSecurityAction(ActionEvent e)
       throws GenericManagerException {
       }
      
       public void cancelSecurityAction(ActionEvent e)
       throws GenericManagerException {
       }
      
       public Object collectSecurityFormData() throws GenericManagerException {
       SecurityInfo secInfo = new SecurityInfo();
       if (UPDATE_DETAIL_ACTION.equals(CURRENT_ACTION)) {
       secInfo.setSecurityInfoId(systemUser.getSecurityInfo()
       .getSecurityInfoId());
       secInfo.setCreatedBy(systemUser.getSecurityInfo().getCreatedBy());
       secInfo.setCreatedDate(systemUser.getSecurityInfo()
       .getCreatedDate());
       }
       secInfo.setOrganizationId(systemUser.getOrganizationId());
       secInfo.setMasterId(systemUser.getUserId());
       secInfo.setMasterType(systemUser.getObjectType());
       secInfo.setLoginTries(systemUser.getSecurityInfo().getLoginTries());
       secInfo.setPassword(systemUser.getSecurityInfo().getPassword());
       secInfo.setPasswordQuestionType(systemUser.getSecurityInfo().getPasswordQuestionType());
       secInfo.setPasswordQuestion(systemUser.getSecurityInfo().getPasswordQuestion());
       secInfo.setPasswordAnswer(systemUser.getSecurityInfo().getPasswordAnswer());
       secInfo.setPasswordExpiry(systemUser.getSecurityInfo().getPasswordExpiry());
       secInfo.setPasswordExpiryByDays(systemUser.getSecurityInfo().getPasswordExpiryByDays());
       secInfo.setUserName(systemUser.getSecurityInfo().getUserName());
       secInfo.setLastlogin(systemUser.getSecurityInfo().getLastlogin());
       return secInfo;
       }
      }
      


      Here is my systemuser.xhtml which holds the modalpanel and the action buttons
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
       <f:view>
       <h:panelGrid columns="2" style="valign:top;">
       <rich:panel id="usrListPnl" style="width:250px;height:400px;"
       header="System Users">
       <rich:dataList id="UIDataTableUsers" var="user"
       value="#{systemUserManager.systemUsers}"
       binding="#{systemUserManager.usersTable}" rows="10">
       <a4j:commandLink actionListener="#{systemUserManager.editAction}"
       value="#{user.firstName}, #{user.lastName}" reRender="usrAdminPnl" />
       </rich:dataList>
       </rich:panel>
       <rich:panel id="usrAdminPnl" style="width:400px;">
       <h:panelGrid columns="2">
       <h:outputText value="User Type: " />
       <rich:inplaceSelect id="userTypeList"
       value="#{systemUserManager.systemUser.userType}">
       <f:selectItems value="#{systemUserManager.userTypeOptions}" />
       </rich:inplaceSelect>
       <h:outputText value="User Department: " />
       <rich:inplaceSelect id="userDepartmentList"
       value="#{systemUserManager.systemUser.departmentId}">
       <f:selectItems value="#{systemUserManager.userDepartmentOptions}" />
       </rich:inplaceSelect>
       <h:outputText value="Salutation: " />
       <rich:inplaceSelect id="userTitleList"
       value="#{systemUserManager.systemUser.title}">
       <f:selectItems value="#{systemUserManager.userTitleOptions}" />
       </rich:inplaceSelect>
       <h:outputText value="First Name: " />
       <h:inputText value="#{systemUserManager.systemUser.firstName}"
       styleClass="textname" />
       <h:outputText value="Last Name: " />
       <h:inputText value="#{systemUserManager.systemUser.lastName}"
       styleClass="textname" />
       <h:outputText value="NRIC / FIN: " />
       <h:inputText value="#{systemUserManager.systemUser.nric}"
       styleClass="textcode" />
       <h:outputText value="Designation: " />
       <h:inputText value="#{systemUserManager.systemUser.designation}"
       styleClass="textname" />
       <h:outputText value="Date of Birth: " />
       <rich:calendar value="#{systemUserManager.systemUser.dateOfBirth}"
       style="textdate" />
       <h:outputText value="Gender:" />
       <h:selectOneRadio value="#{systemUserManager.systemUser.gender}" />
       <rich:spacer />
       <h:panelGrid columns="5">
       <a4j:commandButton
       actionListener="#{systemUserManager.insertAction}" value="Insert"
       rendered="#{not systemUserManager.userEditable}" reRender="usrListPnl" />
       <a4j:commandButton
       actionListener="#{systemUserManager.updateAction}" value="Update"
       binding="#{systemUserManager.userUpdateLink}" rendered="false"
       reRender="usrAdminPnl,usrListPnl" />
       <a4j:commandButton
       actionListener="#{systemUserManager.cancelAction}" value="Cancel"
       rendered="#{systemUserManager.userEditable}"
       reRender="usrAdminPnl,usrListPnl" />
       <a4j:commandButton id="securityLink" value="Security Info"
       actionListener="#{systemUserManager.editSecurityAction}"
       rendered="#{systemUserManager.userEditable}">
       <rich:componentControl for="securityModalPnl"
       attachTo="securityLink" operation="show" event="onclick" />
       </a4j:commandButton>
       </h:panelGrid>
       </h:panelGrid>
       <rich:modalPanel id="securityModalPnl" minHeight="330"
       minWidth="400" height="330" width="400">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText
       value="#{systemUserManager.systemUser.firstName}, #{systemUserManager.systemUser.lastName} Security Info"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage value="/images/modal/close.png"
       styleClass="hidelink" id="securityHidelink" />
       <rich:componentControl for="securityModalPnl"
       attachTo="securityHidelink" operation="hide" event="onclick" />
       </h:panelGroup>
       </f:facet>
       <rich:panel>
       <ui:include src="/risview/administration/employee/securityinfo.xhtml" />
       </rich:panel>
       </rich:modalPanel>
       </rich:panel>
       </h:panelGrid>
       </f:view>
      </ui:composition>
      


      Here is my included securityinfo.xhtml, which has the form to collect information and do the insert update operation
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
       <h:panelGrid columns="2">
       <h:outputText value="User Name: " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.userName}"
       styleClass="textname" />
       <h:outputText value="Password: " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.password}"
       styleClass="textcode" />
       <h:outputText value="Password Type: " />
       <rich:inplaceSelect id="questionTypeList"
       value="#{systemUserManager.systemUser.securityInfo.passwordQuestionType}">
       <f:selectItems
       value="#{systemUserManager.passwdQuestionTypeOptions}" />
       </rich:inplaceSelect>
       <h:outputText value="Security Question: " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.passwordQuestion}"
       styleClass="textname" />
       <h:outputText value="Security Answer: " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.passwordAnswer}"
       styleClass="textname" />
       <h:outputText style="nowrap;" value="Is Password Expire? " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.passwordExpiry}"
       styleClass="textint" />
       <h:outputText value="Expire by Days: " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.passwordExpiryByDays}"
       styleClass="textint" />
       <h:outputText value="Login Tries: " />
       <h:inputText
       value="#{systemUserManager.systemUser.securityInfo.loginTries}"
       styleClass="textint" />
       <h:outputText value="Last Logged: " />
       <rich:calendar readonly="true"
       value="#{systemUserManager.systemUser.securityInfo.lastlogin}"
       style="textdate" />
       <rich:spacer />
       <h:panelGrid columns="3">
       <a4j:commandButton
       actionListener="#{systemUserManager.insertSecurityAction}"
       value="Insert"
       rendered="#{not systemUserManager.userSecurityEditable}"
       oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('securityModalPnl')}.hide();" />
       <a4j:commandButton
       actionListener="#{systemUserManager.updateSecurityAction}"
       value="Update"
       binding="#{systemUserManager.userSecurityUpdateLink}"
       rendered="false" reRender="usrAdminPnl,usrListPnl"
       oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('securityModalPnl')}.hide();" />
       <a4j:commandButton
       actionListener="#{systemUserManager.cancelSecurityAction}"
       value="Cancel"
       rendered="#{systemUserManager.userSecurityEditable}"
       reRender="usrAdminPnl,usrListPnl" />
       </h:panelGrid>
       </h:panelGrid>
      </ui:composition>
      


        • 1. Re: rich:moalpanel with managed-bean property
          nbelaevski

          Hello,

          rich:modalPanel needs its own form to be inside and forms shouldn't be nested. I couldn't find no forms in the code posted, please add and try.

          • 2. Re: rich:moalpanel with managed-bean property
            skumarsamy

            Hi,
            Thanks for your reply.

            But for me all my page composition is within tab and the whole application is inside only one form in my main page, which is my welcome.xhtml.

            Here is my welcome.xhtml

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:rich="http://richfaces.org/rich">
             <ui:composition template="/templates/main.xhtml">
             <ui:define name="title">#{environment.title}</ui:define>
             <ui:define name="body">
             <f:view>
             <h:form>
             <rich:tabPanel switchType="client">
             <rich:tab label="Organization">
             <ui:include src="risview/administration/common/organization.xhtml" />
             </rich:tab>
             <rich:tab label="Location">
             <ui:include src="risview/administration/common/locationmanager.xhtml" />
             </rich:tab>
             <rich:tab label="Security">
             <rich:tabPanel switchType="client">
             <rich:tab label="Privilege">
             <ui:include src="risview/administration/masters/securityprivilege.xhtml" />
             </rich:tab>
             <rich:tab label="Role">
             <ui:include src="risview/administration/masters/securityrole.xhtml" />
             </rich:tab>
             </rich:tabPanel>
             </rich:tab>
             <rich:tab label="Lookup">
             <ui:include src="risview/administration/masters/lookupmanager.xhtml" />
             </rich:tab>
             <rich:tab label="Users">
             <ui:include src="risview/administration/employee/systemuser.xhtml" />
             </rich:tab>
             </rich:tabPanel>
             <rich:modalPanel id="loginModalPnl" minHeight="200"
             minWidth="400" height="200" width="400">
             <f:facet name="header">
             <h:panelGroup>
             <h:outputText
             value="User Login"></h:outputText>
             </h:panelGroup>
             </f:facet>
             <rich:panel>
             <ui:include src="/risview/administration/common/login.xhtml" />
             </rich:panel>
             </rich:modalPanel>
             </h:form>
             </f:view>
             </ui:define>
             </ui:composition>
            </html>
            


            I don't see that there is any problem, as i can submit all my other forms and there is no issue, i have some issue with another modalpanel where i have shuttlelist. I hope that there should be some way to associate parent window with the child modal here that is missing!

            I you have any suggestion please let me know.
            Thanks once again.

            Regards
            Kumar

            • 3. Re: rich:moalpanel with managed-bean property - Soultion
              skumarsamy

              Hi,

              Thanks for the support and suggestion.
              using your thought, i changed my form model, now each view has its own form.

              After a lot of tries i able to get the thing solved.
              Here is my solution for someone in need.

              Here is my managed bean

              package com.radlink.eris.systemuser.manager;
              
              import java.util.ArrayList;
              import java.util.Date;
              import java.util.List;
              import java.util.Map;
              
              import javax.faces.event.ActionEvent;
              import javax.faces.model.SelectItem;
              
              import org.ajax4jsf.component.html.HtmlAjaxCommandButton;
              import org.apache.commons.lang.StringUtils;
              import org.richfaces.component.UIDataList;
              
              import com.radlink.eris.common.bean.BeanHelper;
              import com.radlink.eris.common.entity.ERISBase;
              import com.radlink.eris.common.entity.ERISWebBase;
              import com.radlink.eris.common.manager.ContactManager;
              import com.radlink.eris.common.master.entity.LookupDetail;
              import com.radlink.eris.core.exception.GenericDaoException;
              import com.radlink.eris.core.exception.GenericManagerException;
              import com.radlink.eris.core.manager.ERISApplicationManager;
              import com.radlink.eris.core.manager.IWebManager;
              import com.radlink.eris.core.resources.IMessages;
              import com.radlink.eris.systemuser.dao.ISecurityInfoDAO;
              import com.radlink.eris.systemuser.dao.ISystemUserDAO;
              import com.radlink.eris.systemuser.entity.SecurityInfo;
              import com.radlink.eris.systemuser.entity.SystemUser;
              
              public class SystemUserManager extends ERISWebBase implements IWebManager {
              
               private SystemUser systemUser;
               private SecurityInfo securityInfo;
               private List<SystemUser> systemUsers;
              
               private List<LookupDetail> countries;
               private List<LookupDetail> userTypes;
               private List<LookupDetail> userDepartments;
               private List<LookupDetail> userTitles;
               private List<LookupDetail> employmentTypes;
               private List<LookupDetail> addressTypes;
               private List<LookupDetail> passwdQuestionTypes;
               private List<SelectItem> countryOptions = new ArrayList<SelectItem>();
               private List<SelectItem> userTypeOptions = new ArrayList<SelectItem>();
               private List<SelectItem> userDepartmentOptions = new ArrayList<SelectItem>();
               private List<SelectItem> userTitleOptions = new ArrayList<SelectItem>();
               private List<SelectItem> employmentTypeOptions = new ArrayList<SelectItem>();
               private List<SelectItem> addressTypeOptions = new ArrayList<SelectItem>();
               private List<SelectItem> passwdQuestionTypeOptions = new ArrayList<SelectItem>();
               private String[] lookupNames = { "Country", "User Type", "User Department",
               "Employment Type", "Title", "Password Question Type" };
              
               ContactManager contactManager;
               SecurityManager securityManager;
              
               private boolean userEditable = false;
               private boolean userSecurityEditable = false;
               private UIDataList usersTable;
               private HtmlAjaxCommandButton userUpdateLink;
               private HtmlAjaxCommandButton userSecurityUpdateLink;
              
               ISystemUserDAO systemUserDao;
               ISecurityInfoDAO securityDao;
              
               public SystemUserManager() throws GenericManagerException {
               try {
               /*
               * systemUser = new SystemUser(); securityInfo = new SecurityInfo();
               */
               // systemUser.setSecurityInfo(securityInfo);
               // systemUser.getSecurityInfo().init();
               systemUserDao = BeanHelper.getSystemUserDAO();
               securityDao = BeanHelper.getSecurityInfoDAO();
               systemUsers = systemUserDao
               .getSystemUsers(ERISBase.TEST_ORGNIZATIONID);
               initLookups();
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               @SuppressWarnings("unchecked")
               public void initLookups() throws GenericManagerException {
               Map lookupDetailMap = ERISApplicationManager
               .GetApplicationLookupOptions(lookupNames);
               if (lookupDetailMap != null) {
               Map<String, List<LookupDetail>> lookupDetailsMap = (Map<String, List<LookupDetail>>) lookupDetailMap
               .get(ERISApplicationManager.MAP_LOOKUP);
               Map<String, List<SelectItem>> lookupDetailsOptionMap = (Map<String, List<SelectItem>>) lookupDetailMap
               .get(ERISApplicationManager.MAP_LOOKUP_OPTIONS);
               for (String lookupName : lookupNames) {
               logger.info("Lookup Map: " + lookupDetailsMap.size() + ":"
               + lookupDetailsOptionMap.size());
               logger.info("SystemUser UI Lookup: " + lookupName);
               if ("Country".equals(lookupName)) {
               countries = (List<LookupDetail>) lookupDetailsMap
               .get(lookupName);
               countryOptions = lookupDetailsOptionMap.get(lookupName
               + "Options");
               logger.info("SystemUser UI Lookup: " + lookupName + ":"
               + countries.size());
               } else if ("User Type".equals(lookupName)) {
               userTypes = (List<LookupDetail>) lookupDetailsMap
               .get(lookupName);
               userTypeOptions = lookupDetailsOptionMap.get(lookupName
               + "Options");
               logger.info("SystemUser UI Lookup: " + lookupName + ":"
               + userTypes.size());
               } else if ("User Department".equals(lookupName)) {
               userDepartments = (List<LookupDetail>) lookupDetailsMap
               .get(lookupName);
               userDepartmentOptions = lookupDetailsOptionMap
               .get(lookupName + "Options");
               logger.info("SystemUser UI Lookup: " + lookupName + ":"
               + userDepartments.size());
               } else if ("Employment Type".equals(lookupName)) {
               employmentTypes = (List<LookupDetail>) lookupDetailsMap
               .get(lookupName);
               employmentTypeOptions = lookupDetailsOptionMap
               .get(lookupName + "Options");
               logger.info("SystemUser UI Lookup: " + lookupName + ":"
               + employmentTypes.size());
               } else if ("Title".equals(lookupName)) {
               userTitles = (List<LookupDetail>) lookupDetailsMap
               .get(lookupName);
               userTitleOptions = lookupDetailsOptionMap.get(lookupName
               + "Options");
               logger.info("SystemUser UI Lookup: " + lookupName + ":"
               + userTitles.size());
               } else if ("Password Question Type".equals(lookupName)) {
               passwdQuestionTypes = (List<LookupDetail>) lookupDetailsMap
               .get(lookupName);
               passwdQuestionTypeOptions = lookupDetailsOptionMap
               .get(lookupName + "Options");
               }
               }
               }
               }
              
               public void cancelAction(ActionEvent e) throws GenericManagerException {
               logger.info("Cancelling Edit");
               this.CURRENT_ACTION = CANCEL_ACTION;
               this.clearFields();
               try {
               systemUsers = systemUserDao
               .getSystemUsers(ERISBase.TEST_ORGNIZATIONID);// TODO
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               public void clearFields() {
               logger.info("Cancelling Edit");
               systemUser.reset();
               setUserEditable(false);
               userUpdateLink.setRendered(false);
               }
              
               public Object collectFormData() throws GenericManagerException {
               SystemUser sysUsr = new SystemUser();
               if (UPDATE_ACTION.equals(CURRENT_ACTION)) {
               sysUsr.setOrganizationId(systemUser.getOrganizationId());
               sysUsr.setUserId(systemUser.getUserId());
               sysUsr.setCreatedBy(systemUser.getCreatedBy());
               sysUsr.setCreatedDate(systemUser.getCreatedDate());
               }
               sysUsr.setUserType(systemUser.getUserType());
               sysUsr.setDepartmentId(systemUser.getDepartmentId());
               sysUsr.setTitle(systemUser.getTitle());
               sysUsr.setFirstName(systemUser.getFirstName());
               sysUsr.setLastName(systemUser.getLastName());
               sysUsr.setNric(systemUser.getNric());
               sysUsr.setDesignation(systemUser.getDesignation());
               sysUsr.setDateOfBirth(systemUser.getDateOfBirth());
               sysUsr.setGender(systemUser.getGender());
               sysUsr.setMarkDeleted(systemUser.isDeleted() ? 1 : 0);
               return sysUsr;
               }
              
               private SecurityInfo getSecurityInfo(SystemUser sysUser) {
               SecurityInfo secInfo = new SecurityInfo();
               secInfo.setOrganizationId(sysUser.getOrganizationId());
               secInfo.setMasterId(sysUser.getUserId());
               secInfo.setMasterType(sysUser.getObjectType());
               secInfo.setCreatedBy(sysUser.getCreatedBy());
               secInfo.setCreatedDate(new Date(System.currentTimeMillis()));
               secInfo.setLastUpdatedBy(sysUser.getLastUpdatedBy());
               secInfo.setLastUpdatedDate(new Date(System.currentTimeMillis()));
               return secInfo;
               }
              
               public void deleteAction(ActionEvent e) throws GenericManagerException {
               try {
               logger.info("Deleting");
               this.CURRENT_ACTION = DELETE_ACTION;
               systemUserDao.deleteSystemUser(systemUser);
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               public void editAction(ActionEvent e) throws GenericManagerException {
               logger.info("Editing");
               this.CURRENT_ACTION = EDIT_ACTION;
               setRowDataToForm();
               setUserEditable(true);
               userUpdateLink.setRendered(true);
               }
              
               public void editSecurityAction(ActionEvent e)
               throws GenericManagerException {
               logger.info("Security Editing: " + systemUser.getSecurityInfo());
               securityInfo = systemUser.getSecurityInfo();
               }
              
               public void insertAction(ActionEvent e) throws GenericManagerException {
               try {
               logger.info("Inserting");
               CURRENT_ACTION = INSERT_ACTION;
               SystemUser sysUsr = (SystemUser) collectFormData();
               sysUsr.setOrganizationId(ERISBase.TEST_ORGNIZATIONID);// TODO
               sysUsr.setCreatedBy(ERISBase.TEST_USERID); // TODO
               sysUsr.setCreatedDate(new Date(System.currentTimeMillis()));
               sysUsr.setLastUpdatedBy(ERISBase.TEST_USERID); // TODO
               sysUsr.setLastUpdatedDate(new Date(System.currentTimeMillis()));
               logger.info("Inserting " + sysUsr);
               int userId = systemUserDao.insertSystemUser(sysUsr);
               if (userId > 0) {
               SecurityInfo secInfo = getSecurityInfo(sysUsr);
               int secInfoId = securityDao.insertUserSecurityInfo(secInfo);
               secInfo.setSecurityInfoId(secInfoId);
               }
               sysUsr.setUserId(userId);
               clearFields();
               systemUsers = systemUserDao
               .getSystemUsers(ERISBase.TEST_ORGNIZATIONID);// TODO
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               public void refreshAction(ActionEvent e) throws GenericManagerException {
              
               }
              
               public void setRowDataToForm() throws GenericManagerException {
               logger.info("Setting Form fields");
               systemUser = (SystemUser) usersTable.getRowData();
               if (systemUser != null) {
               try {
               SecurityInfo secInfo = securityDao.getUserSecurityInfo(
               systemUser.getOrganizationId(), systemUser.getUserId(),
               systemUser.getObjectType());
               if (secInfo != null) {
               //if (!StringUtils.isEmpty(secInfo.getUserName())) {
               securityInfo = secInfo;
               logger.info("Security info found: " + securityInfo);
               systemUser.setSecurityInfo(securityInfo);
               /*} else {
               securityInfo = new SecurityInfo();
               securityInfo.setOrganizationId(secInfo.getOrganizationId());
               securityInfo.setMasterId(secInfo.getMasterId());
               securityInfo.setMasterType(secInfo.getMasterType());
               securityInfo.setCreatedBy(secInfo.getCreatedBy());
               securityInfo.setCreatedDate(secInfo.getCreatedDate());
               systemUser.setSecurityInfo(securityInfo);
               } */
               setUserSecurityEditable(true);
               //userSecurityUpdateLink.setRendered(true);
               }
               /*
               * else { systemUser.setSecurityInfo(new SecurityInfo());
               * systemUser.getSecurityInfo().init();
               * setUserSecurityEditable(false);
               * userSecurityUpdateLink.setRendered(false); }
               */
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
               }
              
               public void updateAction(ActionEvent e) throws GenericManagerException {
               try {
               logger.info("Updating");
               CURRENT_ACTION = UPDATE_ACTION;
               SystemUser usr = (SystemUser) collectFormData();
               usr.setLastUpdatedBy(ERISBase.TEST_USERID);
               usr.setLastUpdatedDate(new Date(System.currentTimeMillis()));
               logger.info(usr);
               systemUserDao.updateSystemUser(usr);
               this.userUpdateLink.setRendered(false);
               systemUsers = systemUserDao.getSystemUsers(usr.getOrganizationId());
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               public SystemUser getSystemUser() {
               return systemUser;
               }
              
               public void setSystemUser(SystemUser systemUser) {
               this.systemUser = systemUser;
               }
              
               public SecurityInfo getSecurityInfo() {
               return securityInfo;
               }
              
               public void setSecurityInfo(SecurityInfo securityInfo) {
               this.securityInfo = securityInfo;
               }
              
               public List<SystemUser> getSystemUsers() {
               return systemUsers;
               }
              
               public void setSystemUsers(List<SystemUser> systemUsers) {
               this.systemUsers = systemUsers;
               }
              
               public boolean isUserEditable() {
               return userEditable;
               }
              
               public void setUserEditable(boolean userEditable) {
               this.userEditable = userEditable;
               }
              
               public boolean isUserSecurityEditable() {
               return userSecurityEditable;
               }
              
               public void setUserSecurityEditable(boolean userSecurityEditable) {
               this.userSecurityEditable = userSecurityEditable;
               }
              
               public UIDataList getUsersTable() {
               return usersTable;
               }
              
               public void setUsersTable(UIDataList usersTable) {
               this.usersTable = usersTable;
               }
              
               public HtmlAjaxCommandButton getUserUpdateLink() {
               return userUpdateLink;
               }
              
               public void setUserUpdateLink(HtmlAjaxCommandButton userUpdateLink) {
               this.userUpdateLink = userUpdateLink;
               }
              
               public HtmlAjaxCommandButton getUserSecurityUpdateLink() {
               return userSecurityUpdateLink;
               }
              
               public void setUserSecurityUpdateLink(
               HtmlAjaxCommandButton userSecurityUpdateLink) {
               this.userSecurityUpdateLink = userSecurityUpdateLink;
               }
              
               public List<LookupDetail> getCountries() {
               return countries;
               }
              
               public void setCountries(List<LookupDetail> countries) {
               this.countries = countries;
               }
              
               public List<LookupDetail> getUserTypes() {
               return userTypes;
               }
              
               public void setUserTypes(List<LookupDetail> userTypes) {
               this.userTypes = userTypes;
               }
              
               public List<LookupDetail> getUserDepartments() {
               return userDepartments;
               }
              
               public void setUserDepartments(List<LookupDetail> userDepartments) {
               this.userDepartments = userDepartments;
               }
              
               public List<LookupDetail> getEmploymentTypes() {
               return employmentTypes;
               }
              
               public void setEmploymentTypes(List<LookupDetail> employmentTypes) {
               this.employmentTypes = employmentTypes;
               }
              
               public List<LookupDetail> getAddressTypes() {
               return addressTypes;
               }
              
               public void setAddressTypes(List<LookupDetail> addressTypes) {
               this.addressTypes = addressTypes;
               }
              
               public List<SelectItem> getCountryOptions() {
               return countryOptions;
               }
              
               public void setCountryOptions(List<SelectItem> countryOptions) {
               this.countryOptions = countryOptions;
               }
              
               public List<SelectItem> getUserTypeOptions() {
               return userTypeOptions;
               }
              
               public void setUserTypeOptions(List<SelectItem> userTypeOptions) {
               this.userTypeOptions = userTypeOptions;
               }
              
               public List<SelectItem> getUserDepartmentOptions() {
               return userDepartmentOptions;
               }
              
               public void setUserDepartmentOptions(List<SelectItem> userDepartmentOptions) {
               this.userDepartmentOptions = userDepartmentOptions;
               }
              
               public List<SelectItem> getEmploymentTypeOptions() {
               return employmentTypeOptions;
               }
              
               public void setEmploymentTypeOptions(List<SelectItem> employmentTypeOptions) {
               this.employmentTypeOptions = employmentTypeOptions;
               }
              
               public List<SelectItem> getAddressTypeOptions() {
               return addressTypeOptions;
               }
              
               public void setAddressTypeOptions(List<SelectItem> addressTypeOptions) {
               this.addressTypeOptions = addressTypeOptions;
               }
              
               public List<LookupDetail> getUserTitles() {
               return userTitles;
               }
              
               public void setUserTitles(List<LookupDetail> userTitles) {
               this.userTitles = userTitles;
               }
              
               public List<SelectItem> getUserTitleOptions() {
               return userTitleOptions;
               }
              
               public void setUserTitleOptions(List<SelectItem> userTitleOptions) {
               this.userTitleOptions = userTitleOptions;
               }
              
               public List<LookupDetail> getPasswdQuestionTypes() {
               return passwdQuestionTypes;
               }
              
               public void setPasswdQuestionTypes(List<LookupDetail> passwdQuestionTypes) {
               this.passwdQuestionTypes = passwdQuestionTypes;
               }
              
               public List<SelectItem> getPasswdQuestionTypeOptions() {
               return passwdQuestionTypeOptions;
               }
              
               public void setPasswdQuestionTypeOptions(
               List<SelectItem> passwdQuestionTypeOptions) {
               this.passwdQuestionTypeOptions = passwdQuestionTypeOptions;
               }
              
               public void securityInfoAction(ActionEvent e)
               throws GenericManagerException {
               }
              
               public void insertSecurityAction(ActionEvent e)
               throws GenericManagerException {
               try {
               logger.info("Inserting Security Info");
               CURRENT_ACTION = INSERT_DETAIL_ACTION;
               SecurityInfo secInfo = (SecurityInfo) collectSecurityFormData();
               secInfo.setCreatedBy(ERISBase.TEST_USERID); // TODO
               secInfo.setCreatedDate(new Date(System.currentTimeMillis()));
               secInfo.setLastUpdatedBy(ERISBase.TEST_USERID); // TODO
               secInfo.setLastUpdatedDate(new Date(System.currentTimeMillis()));
               logger.info("Inserting " + secInfo);
               int userSecId = securityDao.insertUserSecurityInfo(secInfo);
               secInfo.setSecurityInfoId(userSecId);
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               public void updateSecurityAction(ActionEvent e)
               throws GenericManagerException {
               try {
               logger.info("Updating Security Info");
               CURRENT_ACTION = UPDATE_DETAIL_ACTION;
               SecurityInfo secInfo = (SecurityInfo) collectSecurityFormData();
               logger.info("Updating " + secInfo);
               securityDao.updateUserSecurityInfo(secInfo);
               } catch (GenericDaoException exp) {
               throw new GenericManagerException(exp.getMessage(), exp
               .getErrorCode(), exp, exp.getParameterValues());
               } catch (Exception exp) {
               throw new GenericManagerException(exp.getMessage(),
               IMessages.ERROR_SYSTEM_MANAGER_UNKNOWN, exp);
               }
               }
              
               public void cancelSecurityAction(ActionEvent e)
               throws GenericManagerException {
               }
              
               public Object collectSecurityFormData() throws GenericManagerException {
               SecurityInfo secInfo = new SecurityInfo();
               logger.info("CUrrent user: " + systemUser);
               secInfo.setOrganizationId(systemUser.getSecurityInfo()
               .getOrganizationId());
               secInfo.setMasterId(systemUser.getSecurityInfo().getMasterId());
               secInfo.setMasterType(systemUser.getObjectType());
               secInfo.setSecurityInfoId(systemUser.getSecurityInfo()
               .getSecurityInfoId());
              
               secInfo.setUserName(securityInfo.getUserName());
               secInfo.setPassword(securityInfo.getPassword());
               secInfo.setPasswordQuestionType(securityInfo.getPasswordQuestionType());
               secInfo.setPasswordQuestion(securityInfo.getPasswordQuestion());
               secInfo.setPasswordAnswer(securityInfo.getPasswordAnswer());
               secInfo.setPasswordExpiry(securityInfo.getPasswordExpiry());
               secInfo.setPasswordExpiryByDays(securityInfo.getPasswordExpiryByDays());
               secInfo.setLoginTries(securityInfo.getLoginTries());
               secInfo.setLastlogin(securityInfo.getLastlogin());
              
               secInfo.setCreatedBy(systemUser.getSecurityInfo().getCreatedBy());
               secInfo.setCreatedDate(systemUser.getSecurityInfo().getCreatedDate());
               secInfo.setLastUpdatedBy(ERISBase.TEST_USERID); // TODO
               secInfo.setLastUpdatedDate(new Date(System.currentTimeMillis()));
               return secInfo;
               }
              }
              


              Here is my master systemuser.xhtml
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:a4j="http://richfaces.org/a4j"
               xmlns:rich="http://richfaces.org/rich">
               <f:view>
               <h:form>
               <h:panelGrid columns="2" style="valign:top;">
               <rich:panel id="usrListPnl" style="width:250px;height:400px;"
               header="System Users">
               <rich:dataList id="UIDataTableUsers" var="user"
               value="#{systemUserManager.systemUsers}"
               binding="#{systemUserManager.usersTable}" rows="10">
               <a4j:commandLink actionListener="#{systemUserManager.editAction}"
               value="#{user.firstName}, #{user.lastName}"
               reRender="usrAdminPnl,secPnl" />
               </rich:dataList>
               </rich:panel>
               <rich:panel id="usrAdminPnl" style="width:400px;">
               <h:panelGrid columns="2">
               <h:outputText value="User Type: " />
               <rich:inplaceSelect id="userTypeList"
               value="#{systemUserManager.systemUser.userType}">
               <f:selectItems value="#{systemUserManager.userTypeOptions}" />
               </rich:inplaceSelect>
               <h:outputText value="User Department: " />
               <rich:inplaceSelect id="userDepartmentList"
               value="#{systemUserManager.systemUser.departmentId}">
               <f:selectItems value="#{systemUserManager.userDepartmentOptions}" />
               </rich:inplaceSelect>
               <h:outputText value="Salutation: " />
               <rich:inplaceSelect id="userTitleList"
               value="#{systemUserManager.systemUser.title}">
               <f:selectItems value="#{systemUserManager.userTitleOptions}" />
               </rich:inplaceSelect>
               <h:outputText value="First Name: " />
               <h:inputText value="#{systemUserManager.systemUser.firstName}"
               styleClass="textname" />
               <h:outputText value="Last Name: " />
               <h:inputText value="#{systemUserManager.systemUser.lastName}"
               styleClass="textname" />
               <h:outputText value="NRIC / FIN: " />
               <h:inputText value="#{systemUserManager.systemUser.nric}"
               styleClass="textcode" />
               <h:outputText value="Designation: " />
               <h:inputText value="#{systemUserManager.systemUser.designation}"
               styleClass="textname" />
               <h:outputText value="Date of Birth: " />
               <rich:calendar value="#{systemUserManager.systemUser.dateOfBirth}"
               style="textdate" />
               <h:outputText value="Gender:" />
               <h:selectOneRadio value="#{systemUserManager.systemUser.gender}" />
               <rich:spacer />
               <h:panelGrid columns="5">
               <a4j:commandButton
               actionListener="#{systemUserManager.insertAction}"
               value="Insert" rendered="#{not systemUserManager.userEditable}"
               reRender="usrAdminPnl,usrListPnl" />
               <a4j:commandButton
               actionListener="#{systemUserManager.updateAction}"
               value="Update" binding="#{systemUserManager.userUpdateLink}"
               rendered="false" reRender="usrAdminPnl,usrListPnl" />
               <a4j:commandButton
               actionListener="#{systemUserManager.cancelAction}"
               value="Cancel" rendered="#{systemUserManager.userEditable}"
               reRender="usrAdminPnl,usrListPnl" />
               <a4j:commandButton id="securityLink" value="Security Info"
               actionListener="#{systemUserManager.editSecurityAction}"
               rendered="#{systemUserManager.userEditable}" reRender="secPnl">
               <rich:componentControl for="securityModalPnl"
               attachTo="securityLink" operation="show" event="onclick" />
               </a4j:commandButton>
               </h:panelGrid>
               </h:panelGrid>
               </rich:panel>
               </h:panelGrid>
               </h:form>
               <rich:modalPanel id="securityModalPnl" minHeight="330" minWidth="400"
               height="330" width="400">
               <f:facet name="header">
               <h:panelGroup>
               <h:outputText
               value="#{systemUserManager.systemUser.firstName}, #{systemUserManager.systemUser.lastName} Security Info"></h:outputText>
               </h:panelGroup>
               </f:facet>
               <f:facet name="controls">
               <h:panelGroup>
               <h:graphicImage value="/images/modal/close.png"
               styleClass="hidelink" id="securityHidelink" />
               <rich:componentControl for="securityModalPnl"
               attachTo="securityHidelink" operation="hide" event="onclick" />
               </h:panelGroup>
               </f:facet>
               <rich:panel id="secPnl">
               <ui:include
               src="/risview/administration/employee/securityinfo.xhtml" />
               </rich:panel>
               </rich:modalPanel>
               </f:view>
              </ui:composition>
              


              Here is my model included child view securityinfo.xhtml
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:a4j="http://richfaces.org/a4j"
               xmlns:rich="http://richfaces.org/rich">
               <h:form>
               <h:panelGrid columns="2">
               <h:outputText value="User Name: " />
               <h:inputText id="userName"
               value="#{systemUserManager.securityInfo.userName}"
               styleClass="textname" />
               <h:outputText value="Password: " />
               <h:inputText id="password"
               value="#{systemUserManager.securityInfo.password}"
               styleClass="textcode" />
               <h:outputText value="Password Type: " />
               <rich:inplaceSelect id="questionTypeList"
               value="#{systemUserManager.securityInfo.passwordQuestionType}">
               <f:selectItems
               value="#{systemUserManager.passwdQuestionTypeOptions}" />
               </rich:inplaceSelect>
               <h:outputText value="Security Question: " />
               <h:inputText id="passwordQuestion"
               value="#{systemUserManager.securityInfo.passwordQuestion}"
               styleClass="textname" />
               <h:outputText value="Security Answer: " />
               <h:inputText id="passwordAnswer"
               value="#{systemUserManager.securityInfo.passwordAnswer}"
               styleClass="textname" />
               <h:outputText style="nowrap;" value="Is Password Expire? " />
               <h:inputText id="passwordExpiry"
               value="#{systemUserManager.securityInfo.passwordExpiry}"
               styleClass="textint" />
               <h:outputText value="Expire by Days: " />
               <h:inputText id="passwordExpiryByDays"
               value="#{systemUserManager.securityInfo.passwordExpiryByDays}"
               styleClass="textint" />
               <h:outputText value="Login Tries: " />
               <h:inputText id="loginTries"
               value="#{systemUserManager.securityInfo.loginTries}"
               styleClass="textint" />
               <h:outputText value="Last Logged: " />
               <rich:calendar readonly="true" id="lastlogin"
               value="#{systemUserManager.securityInfo.lastlogin}" style="textdate" />
               <rich:spacer />
               <h:panelGrid columns="3">
               <a4j:commandButton
               actionListener="#{systemUserManager.insertSecurityAction}"
               value="Insert"
               rendered="#{not systemUserManager.userSecurityEditable}"
               oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('securityModalPnl')}.hide();" />
               <a4j:commandButton
               actionListener="#{systemUserManager.updateSecurityAction}"
               value="Update"
               rendered="#{systemUserManager.userSecurityEditable}"
               reRender="usrAdminPnl,usrListPnl"
               oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('securityModalPnl')}.hide();" />
               <a4j:commandButton
               actionListener="#{systemUserManager.cancelSecurityAction}"
               value="Cancel" rendered="#{systemUserManager.userSecurityEditable}"
               reRender="usrAdminPnl,usrListPnl"
               oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('securityModalPnl')}.hide();" />
               </h:panelGrid>
               </h:panelGrid>
               </h:form>
               <!-- binding="#{systemUserManager.userSecurityUpdateLink}" rendered="false" -->
               <!-- , userName, password, questionTypeList, passwordQuestion, passwordAnswer, passwordExpiry, passwordExpiryByDays, loginTries, lastlogin -->
              </ui:composition>
              
              


              Thanks for you support