Describe how you would configure a filter to initialize with predefined parameters.
- Implement the init() method in the filter
- Set parameters in the doFilter() method
- Use a configuration file
- Use the
in the deployment descriptor
To configure a filter with predefined parameters, use the element in the deployment descriptor (web.xml) to specify initialization parameters. These parameters can be accessed in the filter using the getInitParameter() method.
Loading...
Related Quiz
- Filters are configured in the __________ file of a web application.
- _________ encoding is a common technique to prevent XSS by converting special characters into HTML entities.
- What type of exception is commonly thrown when there is a problem with a SQL query in Java?
- How does the 'String Pool' in Java affect memory management?
- The ability of a transaction to operate independently of other transactions is known as __________.