- - PR -
Struts:ActionクラスでのJNDIコンテキスト取得について
1
| 投稿者 | 投稿内容 |
|---|---|
|
投稿日時: 2003-09-18 14:34
struts1.1+Tomcat4.1.27の環境で、JNDIのコンテキストを
StrutsのPlugInインタフェースを実装したクラスで ServletContextに格納し、それを、Actionクラスでdb接続時に使いたいのですが、 JNDIコンテキストを取得できません。 どなたかStruts等詳しい方、教えてください。よろしくお願い致します。 ------------------------------------------------------------ Actionクラスは、Actionクラスを拡張した独自クラスを使っています。 又、web.xmlの設定は以下となっています。 <context-param> <param-name>DB_SOURCE</param-name> <param-value>jdbc/webdb</param-value> </context-param> -- 使用しているクラスは以下となっています。 ・JNDIConnectorPlugin implements PlugInといったクラス ・上記クラスで、設定パラメータ用のクラスを使っています。 設定パラメータ用のクラスでは、次のような処理が入っています。 コンテクストの初期化パラメータ取得処理で Enumeration props = context.getInitParameterNames(); で、propsにput(name,value)しています。 ・public class TestAction extends Action クラス →ここでは、 public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { を使用してあります。このメソッド内でpropsを取得したいのです。 |
1
