Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 显示标记、分组和空行_Java_Jsp_Grouping_Displaytag - Fatal编程技术网

Java 显示标记、分组和空行

Java 显示标记、分组和空行,java,jsp,grouping,displaytag,Java,Jsp,Grouping,Displaytag,我正在寻找一种方法来进行分组,但分组标题与细节分开。这可能不是很清楚,所以这里有一个例子: 如果我只是将组添加到displaytag表中,我会得到如下结果: | group1 | item1 | | | item2 | | | item3 | | group2 | item4 | | | item5 | | group1 | | | | item1 | | | item2 | | | item3

我正在寻找一种方法来进行分组,但分组标题与细节分开。这可能不是很清楚,所以这里有一个例子:

如果我只是将组添加到displaytag表中,我会得到如下结果:

| group1 | item1 |
|        | item2 |
|        | item3 |
| group2 | item4 |
|        | item5 |
| group1 |       | 
|        | item1 |
|        | item2 |
|        | item3 |
| group2 |       |
|        | item4 |
|        | item5 |
我想要一些像:

| group1 | item1 |
|        | item2 |
|        | item3 |
| group2 | item4 |
|        | item5 |
| group1 |       | 
|        | item1 |
|        | item2 |
|        | item3 |
| group2 |       |
|        | item4 |
|        | item5 |

我在文件中找不到任何东西。有人知道这附近有没有工作吗?或者我应该回到简单的手写JTSL吗?

抱歉,聚会迟到了7个月,但是试着使用
多级TotalTableDecorator
decorator,它会按照您的要求生成一个空行,但这实际上是decorator应该做的事情的副作用。你将不得不使用其他选项来让它做你想做的事情

<%
        // you can do this as a scriptlet on the page, but i put it into a taglib...
        org.displaytag.decorator.MultilevelTotalTableDecorator subtotals = new org.displaytag.decorator.MultilevelTotalTableDecorator();
        subtotals.setGrandTotalDescription("&nbsp;");    // optional, defaults to Grand Total
        subtotals.setSubtotalLabel("&nbsp;", null);
        pageContext.getRequest().setAttribute("subtotaler", subtotals);
%>
<display:table name="contacts" id="contactRow" defaultsort="1" defaultorder="ascending" decorator="subtotaler">
    <display:column property="contactType" title="Contact Type" total="true" group="1"/>
    <display:column property="contactDate" format="{0,date,MM/dd/yyyy}" title="Date" />
    <display:column property="contactName" title="Name" />
    <display:column property="contactPhone" title="Phone" />
    <display:column property="contactEmail" title="Email" />
</display:table>

很抱歉,聚会迟到了7个月,但请尝试使用
多级TotalTableDecorator
decorator,它会根据您的要求生成一个空行,但这实际上是decorator应该做的事情的副作用。你将不得不使用其他选项来让它做你想做的事情

<%
        // you can do this as a scriptlet on the page, but i put it into a taglib...
        org.displaytag.decorator.MultilevelTotalTableDecorator subtotals = new org.displaytag.decorator.MultilevelTotalTableDecorator();
        subtotals.setGrandTotalDescription("&nbsp;");    // optional, defaults to Grand Total
        subtotals.setSubtotalLabel("&nbsp;", null);
        pageContext.getRequest().setAttribute("subtotaler", subtotals);
%>
<display:table name="contacts" id="contactRow" defaultsort="1" defaultorder="ascending" decorator="subtotaler">
    <display:column property="contactType" title="Contact Type" total="true" group="1"/>
    <display:column property="contactDate" format="{0,date,MM/dd/yyyy}" title="Date" />
    <display:column property="contactName" title="Name" />
    <display:column property="contactPhone" title="Phone" />
    <display:column property="contactEmail" title="Email" />
</display:table>


第一个和第二个结果之间有什么区别???这似乎是同样的结果。。。你能再解释一下你的问题吗…你的示例格式丢失了-你能重新格式化示例吗?Markdown不允许标记。我用一个代码块重新格式化了示例。第一个结果和第二个结果有什么区别???这似乎是同样的结果。。。你能再解释一下你的问题吗…你的示例格式丢失了-你能重新格式化示例吗?Markdown不允许标记。我使用代码块重新格式化了示例。