1

In my Java web application, the NTLM domain controller name is specified in web.xml like this:

<filter>
<!-- other code -->
    <init-param>
        <param-name>jcifs.http.domainController</param-name>
        <param-value>DCNAME</param-value>
   </init-param>
<!-- other code -->
</filter>

In the above XML, we've hard-coded the domain controller name (DCNAME) in the param-value tag.

Now, is it possible to read this 'DCNAME' from a JNDI variable, instead of hard-coding it in web.xml file?

thanks in advance.

4

2 回答 2

2

请参阅此链接。您需要像这样定义环境资源:

 <Environment name="myName" value="whatever"
         type="java.lang.String" override="false"/>

然后从代码中读取它:

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
String myName = (String) envCtx .lookup("myName");
于 2009-02-05T07:01:50.930 回答
0

可以使用传递此参数的 JNDI 在 servlet 的 init() 中读取它。

于 2009-02-05T06:42:54.337 回答