开发者

WebSphere Portal: name space bindings. How to Get a Variable?

I have a String variable that is binded to a WebSphere Portal (via admin console): Binding type : string | Binding identifier : threshold | Name in name space : repos/threshold | String value : 开发者_C百科30

Now, I need to get this variable in my enterprise app, which is deployed on this portal. I've heard that it can be done with a help of ExternalContext. Maybe there are other ways. Please, give me an example and explanation =)


Dmitry,

I have just succeeded in doing this using the following code:

Context initial_ctx;
initial_ctx = new InitialContext();
String threshold = (String) initial_ctx.lookup("repos/threshold");

Although in my case the Name in the Name space was just "theshold".

You may need to check the "Scope" of your Name Space Binding as defined in the Websphere admin console. It may need to match the value returned by the call to "initial_ctx.getNameInNamespace()". It did in my case, but that may not be necessary or sufficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜