The servlet container provides the initialization parameters for a servlet or filter within the configuration object the container passes to the init method. The configuration object provides agetInitParameter() function that takes a std::string name and returns the contents of the initialization parameter by that name. A filter uses the configuration object to access initialization parameters. A servlet uses the convenience functions provided by rwsf::GenericServlet to access initialization parameters directly.
The code sample below shows a servlet retrieving the initialization parameters from the servlet element shown in Section 4.2.
std::string greeting = getInitParameter("greeting"); std::string fontsize = getInitParameter("fontsize"); |
If the instance definition does not contain an initialization parameter with the name provided, the getInitParameter() function returns an empty string.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.