Consider the code shown in the exhibit for the init() method of a HTTP
servlet.
public void init()
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// 1 Get DBURL here
theConnection = DriverManager.getConnection(dbUrl, "admin", "admin");
}
Which of the following LOCs "may" correctly retrieve the DBURL parameter at //1?
(Assume that servletcontext is a reference to ServletContext for this servlet.)
Ans: servletcontext.getInitParameter("DBURL");
Here is the answer valid as init method cannot access any implicit object except ServletConfig.