1

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.

1 Answer 1

1

No, you can't populate web.xml dynamically

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.