AnswerBun.com

Can you use a variable from context.xml in the web.xml

Stack Overflow Asked on December 16, 2020

I have a defined resource in context.xml with credentials that need to be fed into the web.xml file as the app uses hardcoded credentials within the web.xml to start. What do I use to make the credentials from the context.xml populate the web.xml dynamically?

context.xml resource:

  <Resource name="jdbc/myDataSource" auth="Container" type="javax.sql.DataSource"
  driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@1.1.1.1:1521:XE" userName="myUsername"
passWord="myPassword"/>

And this is where I need the username and password to get inserted in the web.xml for JDBCUser and JDBCPassword

<init-param>
         <param-name>JDBCDriverClass</param-name>
         <param-value>oracle.jdbc.driver.OracleDriver</param-value>
      </init-param>
      <init-param>
         <param-name>JDBCUrl</param-name>
         <param-value>dbc:oracle:thin:@1.1.1.1:1521:X</param-value>
      </init-param>
      <init-param>
         <param-name>JDBCUser</param-name>
         <param-value>userName</param-value>
      </init-param>    
      <init-param>
         <param-name>JDBCPassword</param-name>
         <param-value>passWord</param-value>

Would something like this work?

<param-name>JDBCPassword</param-name>
             <param-value>${userName}</param-value>

Not sure how to go about this.

One Answer

No, you can't populate web.xml dynamically

Answered by saonnet on December 16, 2020

Add your own answers!

Related Questions

C# find the greatest common divisor

11  Asked on January 5, 2022 by user2723261

   

Time series summary

2  Asked on January 5, 2022 by naanan_

     

Compute frequencies for groups of variables

3  Asked on January 5, 2022 by armel-tedjou

       

How to plot entropart Diversity profiles in ggplot2

1  Asked on January 5, 2022 by alejandra-dip

   

Laravel 6.4.1 SQLSTATE[HY000] [2002] Connection refused

12  Asked on January 5, 2022 by manish-mahajan

         

How to get the key of an element in firebase with AngularFire2?

1  Asked on January 5, 2022 by juan-esteban-rios-gonzalez

         

(PowerShell) How do I filter usernames with Get-EventLog

3  Asked on January 5, 2022 by jeremiah-williams

     

pandas isin() fail between dataframes with objects types columns

1  Asked on January 5, 2022 by franco-milanese

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP