使用Struts2的< s:property> < display:table>中的标记标签 [英] Use Struts2's <s:property> tag in <display:table> tags
问题描述
我正在尝试使用DisplayTag将列表添加到表中.
I am trying to add a list into a table using DisplayTag.
当我以通常的方式将list属性添加到列时,一切工作正常:
Everything works normally when I add list property to a column in the usual manner:
<display:column property="status" title="Claim Status"/>
<display:column property="authNo" title="Authorization Number" href="authSlipMasterAction">
现在,我想检查authNo是否为空;如果为空白,则不提供链接,那么如何在<display:table>
标记中使用<s:if test=''>
和<s:property value="">
?
Now, I want to check when authNo is not blank; if it is blank, then do not provide the link, so how can I use <s:if test=''>
and <s:property value="">
in the <display:table>
tag ?
我尝试使用<s:property value="authNo"/>
显示值,但未显示任何值(我必须显示该值,因为我想检查条件)
I've tried to display the value using <s:property value="authNo"/>
but no value is shown (I have to display the value because I want to check the condition)
这是我的代码
<display:table uid="myTable" id="display-tag" name="session.claimReportList">
<display:column title="Authorization No">
<s:property value="#attr.myTable.transNo" />
</display:column>
我也尝试过
I have also tried
<s:property value="#session.myTable.transNo" />
推荐答案
在DisplayTag列中时,您需要在<s:property />
或<s:if />
中使用#attr.
表示法;您还需要使用#attr.
之后在<display:table>
标记中指定的uid
来访问对象.
You need to use the #attr.
notation in your <s:property />
or <s:if />
when inside a DisplayTag column; you also need to use the uid
specified in the <display:table>
tag after the #attr.
to access your objects.
例如:
<display:table requestURI="actionURL" uid="myTable" />
<display:column title="authNo">
<s:property value="#attr.myTable.authNo" />
</display:column>
</display:table>
#attr['foo']
或#attr.foo
访问PageContext
(如果有),否则进行搜索
request
/session
/application
Access to PageContext
if available, otherwise searches
request
/session
/application
respectively
PS:我考虑考虑使用一些较新的网格,例如 jqGrid 或数据表.
P.S: I'd consider taking a look at some newer grid like jqGrid or DataTables, though.
这篇关于使用Struts2的< s:property> < display:table>中的标记标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!