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 PageValueModule extends BaseModule 16 { 17 public void loadPageVariable( WebPageRequest inContext ) throws Exception 18 { 19 PageAction inAction = inContext.getCurrentAction(); 20 String key = inAction.getConfig().getAttribute("bean"); 21 22 String className = inAction.getConfig().getAttribute("class"); 23 if ( className != null) 24 { 25 SessionTool classTool = (SessionTool)inContext.getPageValue( PageRequestKeys.CLASSTOOL ); 26 inContext.putPageValue( key, classTool.construct( key, className ) ); 27 return; 28 } 29 else 30 { 31 Object bean = getBeanFactory().getBean(key); 32 if ( bean != null) 33 { 34 inContext.putPageValue(key,bean); 35 return; 36 } 37 } 38 throw new OpenEditException("No such bean " + key); 39 } 40 } 41 | Popular Tags |