My linux world » JAVA Spring – Theme + Locale

JAVA Spring - Theme + Locale


Prerequistes

Please read :

Configuration

In WebMvcConfig.java, you just need to register boths interceptors like this :

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    ThemeChangeInterceptor themeInterceptor = new ThemeChangeInterceptor();
    themeInterceptor.setParamName("theme");
    registry.addInterceptor(themeInterceptor);
 
    LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor();
    interceptor.setParamName("lang");
    registry.addInterceptor(interceptor);
  }

Copyright © 2024 My linux world - by Marc RABAHI
Design by Marc RABAHI and encelades.