A servlet needs to load database settings at startup. How should these settings be passed to the servlet?

  • Hardcode the settings in the servlet code
  • Store settings in a local properties file
  • Use ServletContext parameters
  • Use request parameters
The recommended approach is to use ServletContext parameters to pass settings at servlet startup, as they can be accessed by all servlets within the same web application. Hardcoding or using request parameters may not be suitable for initialization settings.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *