JSP Tag Files in subdirectories, using a single taglib prefix. Is that possible?

前端 未结 3 1288
南方客
南方客 2021-02-20 00:04

I currently have my .tag files declared with:

<%@taglib prefix=\"t\" tagdir=\"/WEB-INF/tags\" %>

Example of the path of a tag file :

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 00:30

    Define them as in a single .tld file which you put in /WEB-INF folder.

    E.g. /WEB-INF/my-tags.tld

    
        
        My custom tags    
        1.0
        my
        http://example.com/tags
    
        
            foo
            /WEB-INF/tags/users/foo.tag
        
    
        
            bar
            /WEB-INF/tags/widgetsA/bar.tag
        
    
        
            baz
            /WEB-INF/tags/widgetsB/baz.tag
        
    
    

    Use it in your JSPs as follows

    <%@taglib prefix="my" uri="http://example.com/tags" %>
    ...
    
    
    
    

提交回复
热议问题