Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

viewresolver cyrillic

public class SpringConfig implements WebMvcConfigurer {

    private final ApplicationContext applicationContext;

    @Autowired
    public SpringConfig(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    @Bean
    public SpringResourceTemplateResolver templateResolver() {
        SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
        templateResolver.setApplicationContext(applicationContext);
        templateResolver.setPrefix("/WEB-INF/views/");
        templateResolver.setSuffix(".html");
        templateResolver.setCharacterEncoding("UTF-8");
        return templateResolver;
    }

    @Bean
    public SpringTemplateEngine templateEngine() {
        SpringTemplateEngine templateEngine = new SpringTemplateEngine();
        templateEngine.setTemplateResolver(templateResolver());
        templateEngine.setEnableSpringELCompiler(true);
        return templateEngine;
    }

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        ThymeleafViewResolver resolver = new ThymeleafViewResolver();
        resolver.setTemplateEngine(templateEngine());
        resolver.setCharacterEncoding("UTF-8");
        registry.viewResolver(resolver);
    }
}
Comment

viewresolver cyrillic

public class MySpringMvcDispatcherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return null;
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{SpringConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }

    @Override
    protected Filter[] getServletFilters() {
        CharacterEncodingFilter filter = new CharacterEncodingFilter();
        filter.setEncoding("UTF-8");
        filter.setForceEncoding(true);
        return new Filter[] { filter };
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# methods 
Csharp :: unity Polymorphism 
Csharp :: .net SaveChanges vs update difference 
Csharp :: c# changimg to one decimal place 
Csharp :: c# asp.net only displays name of property 
Csharp :: add getenumerator to class c# 
Csharp :: .net ssh, wait command execute 
Csharp :: assign a list to another in c# without a loop 
Csharp :: Runtime.getRuntime().addShutdownHook(printingHook); c# 
Csharp :: Avoid auto-filling persian time picker 
Csharp :: panning script c# on phone 
Csharp :: sqldatareader get row count 
Csharp :: netlifycms disable preview 
Csharp :: wcf service dependency injection 
Csharp :: how to select multiple toggles at once in unity 
Csharp :: how to use external resource.resx file in c# 
Csharp :: c# how to divide a list every 4 count 
Csharp :: c# null coalescing operator 
Csharp :: c# enum to string 
Csharp :: c# datagridview filter 
Csharp :: array in unity 
Csharp :: c# form 
Csharp :: how to make a enemy in unity 
Csharp :: c# convert ad objectguid to string 
Csharp :: RadioButton IsChecked mapped to ENum xmal 
Html :: font-awesome envelope 
Html :: align eliment in center of row bootstrap 
Html :: bullet 
Html :: html tab 
Html :: no history input html 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =