Search code examples
javajspservletsjspx

how to use a collection in a parameterized tagx file?


I'd like to convert a tag file to a tagx, but I can't find out how to re-write the attribute name/type declaration (last line):

TAG:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tag"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/functions' prefix='fn'%>
<%@ tag import="myPackage.*"%>
<%@ attribute name="treeMap" type="java.util.Collection"%>  <!-- ##### this one #### -->

TAGX:

<?xml version="1.0" encoding="utf-8"?>
<jsp:root
    version="2.1"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
        xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:tag="/WEB-INF/tags"
    import="myPackage.*"
>

Can somebody tell me the appropirate syntax for <%@ attribute name="treeMap" type="java.util.Collection"%>? :)


Solution

  • It should just be:

    <jsp:directive.tag import="myPackage.*"/>
    <jsp:directive.attribute name="treeMap" type="java.util.Collection"/>
    

    By the way, it looks like you're actually referring to .tag and .tagx files...