How to declare jsp custom tag in configuration class of Java web application

I am using configuration class instead of web.xml in a Java web project. I have created the tag handler class and defined a TLD file inside the WEB-INF directory. Now I need to include the jsp custom tag library in my web application. I really would appreciate if someone give me some example of declaring TLD in my configuration class which is something like this:

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "com.**")
@EnableAspectJAutoProxy
public class AppConfig extends WebMvcConfigurerAdapter{
    @Autowired
    RoleToUserProfileConverter roleToUserProfileConverter;

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {

        InternalResourceViewResolver viewResolver = new   InternalResourceViewResolver();
        viewResolver.setViewClass(JstlView.class);
        viewResolver.setPrefix("/WEB-INF/views/");
        viewResolver.setSuffix(".jsp");
        registry.viewResolver(viewResolver);
    }


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("/static/");
    }

}

I finally Generated my TLD using java annotation (TLDGen). A perfect example is: http://blog.extrema-sistemas.com/tldgen/

TLDGen is a standalone library that does not have external dependencies. This is an important requirement to be able to generate our own TLD files.

链接地址: http://www.djcxy.com/p/74678.html

上一篇: JSP:使用表达式作为tablib属性的值

下一篇: 如何在Java Web应用程序的配置类中声明jsp自定义标记