Hi,
have the confg.xml as follows
As this is in session, should this not be created only once for a user/session?Code:<bean id="applicationBean" class="com.framework.view.common.bean.ApplicationBean" scope="session" > </bean>
I have more than one object of this being created
My ApplicationBean is as follows
The BaseBean extends ConObjectCode:public class ApplicationBean extends BaseBean { /** * */ private static final long serialVersionUID = 4238807744322271127L; private String appTitle; @SuppressWarnings("unused") private String pageTitle; @SuppressWarnings("unused") private String currentPage="login.faces"; // the logger for this class private Log logger = LogFactory.getLog(this.getClass()); HtmlInputHidden title; HtmlInputHidden searchString; /** * Default Constructor. * * @throws FacesException * If internal error occurs while retrieves categories */ public ApplicationBean() { super(); this.logger.debug("ApplicationBean is created"); } public String getAppTitle() { return appTitle; } public void setAppTitle(String appTitle) { this.appTitle = appTitle; } public String getPageTitle() { return title.getValue().toString(); } public String getStrSearch(){ return searchString.getValue().toString(); } public void setPageTitle(String pageTitle) { this.pageTitle = pageTitle; } public HtmlInputHidden getTitle() { return title; } public void setTitle(HtmlInputHidden title) { this.title = title; } public HtmlInputHidden getSearchString() { return searchString; } public void setSearchString(HtmlInputHidden searchString) { this.searchString = searchString; } }
Base Bean is as follows
ConObject isCode:public class BaseBean extends ConObject implements IBaseBean, Serializable { /** * This bean is the parent of all view beans that represent a model object */ private static final long serialVersionUID = -172442932994218985L; /** * When a row is changed in an updatable * grid this value is stored in the change row field */ public static final String CHANGE="CHANGE"; /** * When a row is inserted into an updatable * grid this value is stored in the change row field */ public static final String NEW="NEW"; /** * When a row is marked for delete in an updatable * grid this value is stored in the change row field */ public static final String DELETE="DELETE"; /** * This is the property for the heading select box */ protected boolean selectAll = false; /** * This is the select box on each row */ protected boolean rowsSelect = false; /** * This field stores the row status CHANGE NEW DELETE and "" * when no changes have occurred * the default value ="" */ private String changeRow=""; public Boolean[] viewed={false,false,false,false,false}; protected boolean showToggle=false; public List<String> valErrorList; public String scratchPad; public BaseBean() { init(); } protected void init() { } public void runInit() { this.init(); } }
Is there any issue with this?Code:public class ConObject { protected static JdbcLogError execLogError; protected Date today = AppUtils.getSysdate(); protected String executionTime; protected FacesContext fc; protected ExternalContext ctx; protected String message; protected String statusMessage; protected boolean showMessage; protected final Log logger = LogFactory.getLog(this.getClass()); protected Date now=new Date(); protected String returnPath; protected ServletContext context; protected ApplicationContext appContext; private boolean collapsed; protected String returnAction; public ConObject() { super(); fc = FacesContext.getCurrentInstance(); ctx = fc.getExternalContext(); context = FacesUtils.getServletContext(); appContext= WebApplicationContextUtils.getRequiredWebApplicationContext(context); } public ApplicationContext getAppCtx() { ServletContext context = FacesUtils.getServletContext(); return WebApplicationContextUtils .getRequiredWebApplicationContext(context); } }
Thanks
Vinaya


Reply With Quote