1 4 package com.openedit.modules; 5 6 import com.openedit.OpenEditException; 7 import com.openedit.WebPageRequest; 8 import com.openedit.page.PageAction; 9 import com.openedit.page.PageRequestKeys; 10 import com.openedit.util.SessionTool; 11 12 15 public class SessionValueModule extends BaseModule 16 { 17 public void loadSessionVariable( WebPageRequest inContext ) throws Exception 18 { 19 PageAction inAction = inContext.getCurrentAction(); 20 String key = inAction.getConfig().getAttribute("bean"); 21 Object bean = inContext.getSessionValue(key); 22 if( bean != null) 23 { 24 return; 25 } 26 String className = inAction.getConfig().getAttribute("class"); 27 if ( className != null) 28 { 29 SessionTool classTool = (SessionTool)inContext.getPageValue( PageRequestKeys.CLASSTOOL ); 30 inContext.putPageValue( key, classTool.construct( key, className ) ); 31 return; 32 } 33 else 34 { 35 bean = getBeanFactory().getBean(key); 36 if ( bean != null) 37 { 38 inContext.putSessionValue(key,bean); 39 return; 40 } 41 } 42 throw new OpenEditException("No such bean " + key); 43 } 44 } 45 | Popular Tags |