Given the following line of code in a servlet:
String dburl = getServletContext().getInitParameter("DBURL");
The web.xml for this web application contains the following:
<context-param>
<param-name>DBURL</param-name>
<param-value>jdbc:odbc:MySQLODBC</param-value>
</context-param>
Which of the following statements are correct?
The following was given as the solution:
The value for DBURL cannot be changed programmatically.
Where is the value being changed programmatically, or at all?
Rob Millican
rbmillican@hotmail.com
About Question enthuware.jwpv6.2.1214 :
Moderator: admin
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1214 :
It is not being changed in the given code. It just shows how DBURL is being retrieved. The statement in the option claims that it cannot be changed programmatically, which is correct.
HTH,
Paul.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 18
- Joined: Wed Jan 20, 2016 7:16 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1214 :
What about setInitParameter(java.lang.String name, java.lang.String value) of ServletContext?
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1214 :
setInitParameter works only if a parameter is not set already. It cannot change a value if it is set in the DD.
https://docs.oracle.com/javaee/6/api/ja ... tParameter(java.lang.String, java.lang.String)
https://docs.oracle.com/javaee/6/api/ja ... tParameter(java.lang.String, java.lang.String)
If you like our products and services, please help us by posting your review here.
-
- Posts: 5
- Joined: Sat Dec 05, 2015 7:49 pm
- Contact:
Re: About Question enthuware.jwpv6.2.1214 :
Thank you for your reply. I take this exam this coming Monday so it was important for me to clarify this. Thanks.admin wrote:setInitParameter works only if a parameter is not set already. It cannot change a value if it is set in the DD.
https://docs.oracle.com/javaee/6/api/ja ... tParameter(java.lang.String, java.lang.String)
Who is online
Users browsing this forum: No registered users and 49 guests