cancel
Showing results for 
Search instead for 
Did you mean: 

how to use substitution variable in webdynpro java [CE7.2 NWDS]

Former Member
0 Kudos

hi experts,

Can you please explain how to use "substitution variable" in webdynpro java. I am using CE7.2 NWDS. I shall appreciate if you can share some code sample. Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member40425
Contributor
0 Kudos

Hi Pramod,

First of all go to Resource->WEB-INF-Web.xml folder of your DC.

In web.xml create env-entry. To create env-entry use following tag in the source code of the xml.

<env-entry>
            <description><DECRIPTION></description>
            <env-entry-name><ENV_NAME></env-entry-name>
            <env-entry-type><ENV_TYPE></env-entry-type>
            <env-entry-value><${<SUBTITUTION_VARIABLE_NAME>}></env-entry-value>
      </env-entry>

ENV-TYPE should same as type of substitution variable. Ex: java.lang.String

Now you can get value of Subtitution Variable using following code in your java code.

String VARIABLE_NAME= "java:comp/env/ENV_NAME";
InitialContext ctx = new InitialContext();
String SUBTITUTION_VARIABLE_VALUE= (String) ctx.lookup(VARIABLE_NAME);

I hope it helps.

Regards,

Rohit

Answers (2)

Answers (2)

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

fyi, I have moved this thread to wd4java forum

former_member214355
Contributor
0 Kudos

Hello pramod

I see that you have not recieved any replies to your question.

Can you provide anymore information about the problem that you are experiencing which may help get some replies?

Thanks

Kenny

Moderator