【问题标题】:How can i pass the parameter using the display tag?如何使用显示标签传递参数?
【发布时间】:2012-10-06 13:52:30
【问题描述】:

我正在使用显示标签。在我的显示:列中,我需要记录中的 href 链接,如果单击计数的链接,它会转到我的 struts 操作页面,同时我需要“哪个实例类型”和'rating element id'。所以请给我建议将值作为查询字符串传递..目前正在使用struts 1.2.9版 我的示例代码是,

<c:if test="${(asnAccuracyListUID.instanceType != null && asnAccuracyListUID.instanceType != 'Sum')}">
    <display:column property="instanceTypeDescription" title="Instance Type" sortable="false"/>
</c:if>
<c:if test="${(asnAccuracyListUID.instanceType != null && asnAccuracyListUID.instanceType == 'Sum')}">
    <display:column property="instanceType" title="Instance Type" sortable="false" style="font-weight:bold;text-align:center"/>
</c:if>

<display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" sortable="false" >
    <a href="weeklyDlvyInstancesDashboardReportPost.do?method=WeeklyDlvyInstExcelReport&instanceType=${asnAccuracyListUID.instanceType}&ratingElementId=${asnAccuracyListUID.ratingElementId}">${asnAccuracyListUID.firstWeekOfCount}</a>  
</display:column>
<display:column property="secondWeekOfCount" title="${asnAccuracySecondWeekOfCount}" sortable="false"  />
<display:column property="thirdWeekOfCount" title="${asnAccuracyThirdWeekOfCount}" sortable="false"  />
<display:column property="fourthWeekOfCount" title="${asnAccuracyFourthWeekOfCount}" sortable="false" />
<display:column property="fifthWeekOfCount" title="${asnAccuracyFifthWeekOfCount}" sortable="false" />
<display:column property="sixthWeekOfCount" title="${asnAccuracySixthWeekOfCount}" sortable="false"/>

【问题讨论】:

  • 您正在使用 Struts2... 尝试使用 标签而不是 JSTL 标签,以及
  • 啊好吧...顺便说一句,您的 URL 似乎不正确,您使用的是 '?' 的两倍标记参数...
  • @Swift 对不起,我打错了..
  • 我输入了一些名称“详细信息”。但我想使用 property="firstWeekOfCount" 显示列值

标签: tags struts query-string displaytag querystringparameter


【解决方案1】:

&lt;display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" sortable="false" &gt; 中删除property="firstWeekOfCount"

【讨论】:

  • 如果我删除该属性,它不会显示任何内容。为什么你说要删除该属性。您是否出于特定原因想说什么?你能详细解释一下吗?谢谢。
【解决方案2】:

我的问题是..

<display:table name="${weeklyDlvyInstancesDashboardReportForm.asnAccuracyListQO}" uid="asnAccuracyListUID" sort="list" defaultsort="1" 
                                        requestURI="/weeklyDlvyInstancesDashboardReportPre.do?method=httpGet" excludedParams="method"
                                        decorator="com.ford.mpl.superg.decorator.WeeklyDeliveryInstancesTypeTableDecorator" keepStatus="true">
                                        <%@include file="/jsp/include/displaytag.jsp"%>
                                        <c:set value="${asnAccuracyListUID.firstWeekOfCountLabel}" var="asnAccuracyFirstWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.secondWeekOfCountLabel}" var="asnAccuracySecondWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.thirdWeekOfCountLabel}" var="asnAccuracyThirdWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.fourthWeekOfCountLabel}" var="asnAccuracyFourthWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.fifthWeekOfCountLabel}" var="asnAccuracyFifthWeekOfCount"/>
                                        <c:set value="${asnAccuracyListUID.sixthWeekOfCountLabel}" var="asnAccuracySixthWeekOfCount"/>

                                        <c:if test="${(asnAccuracyListUID.instanceType != null && asnAccuracyListUID.instanceType != 'Sum')}">
                                            <display:column property="instanceTypeDescription" title="Instance Type" sortable="false"/>
                                        </c:if>
                                        <c:if test="${(asnAccuracyListUID.instanceType != null && asnAccuracyListUID.instanceType == 'Sum')}">
                                            <display:column property="instanceType" title="Instance Type" sortable="false" style="font-weight:bold;text-align:center"/>
                                        </c:if>

                                        <display:column property="firstWeekOfCount" title="${asnAccuracyFirstWeekOfCount}" href="${pageContext.request.contextPath }/weeklyDlvyInstancesDashboardReportPost.do?method=WeeklyDlvyInstExcelReport" paramProperty="instanceType" paramId="instanceTypeForJSP" sortable="false" />                          
       <display:column property="secondWeekOfCount" title="${asnAccuracySecondWeekOfCount}" sortable="false"  />
                                        <display:column property="thirdWeekOfCount" title="${asnAccuracyThirdWeekOfCount}" sortable="false"  />
                                        <display:column property="fourthWeekOfCount" title="${asnAccuracyFourthWeekOfCount}" sortable="false" />
                                        <display:column property="fifthWeekOfCount" title="${asnAccuracyFifthWeekOfCount}" sortable="false" />
                                        <display:column property="sixthWeekOfCount" title="${asnAccuracySixthWeekOfCount}" sortable="false"/>
                                    </display:table>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-20
    • 1970-01-01
    • 1970-01-01
    • 2011-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多