如何在参数化的tagx文件中使用集合?

时间:2013-01-24 13:43:30

标签: java jsp servlets jspx

我想将标记文件转换为tagx,但我无法找到如何重写属性名称/类型声明(最后一行):

标签:

<%@ 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.*"
>

有人可以告诉我<%@ attribute name="treeMap" type="java.util.Collection"%>的适当语法吗? :)

1 个答案:

答案 0 :(得分:0)

应该是:

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

顺便说一句,看起来你实际上指的是.tag和.tagx文件......