Since Servlet 3.0, you can programmatically set them via ServletContext#setInitParameter()
.
Just put below ServletContextListener
anywhere in your web project. The @WebListener
annotation will make the container to automatically pickup and run it during webapp startup.
@WebListener
public class Config implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent event) {
ServletContext servletContext = event.getServletContext();
servletContext.setInitParameter("com.sun.faces.numberOfLogicalViews", "10");
}
@Override
public void contextDestroyed(ServletContextEvent event) {
// NOOP.
}
}