KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > modules > PageValueModule


1 /*
2  * Created on Dec 6, 2004
3  */

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 /**
13  * @author Matthew Avery, mavery@einnovation.com
14  */

15 public class PageValueModule extends BaseModule
16 {
17     public void loadPageVariable( WebPageRequest inContext ) throws Exception JavaDoc
18     {
19         PageAction inAction = inContext.getCurrentAction();
20         String JavaDoc key = inAction.getConfig().getAttribute("bean");
21
22         String JavaDoc 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 JavaDoc 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