【问题标题】:what tag should we use for struts 1 < bean:size tag in struts 2我们应该为 struts 1 使用什么标签 < bean:size 标签在 struts 2 中
【发布时间】:2018-06-01 18:23:19
【问题描述】:

在我的代码中,我使用了来自 sturts 的 bean 标签库。现在我想从 1 迁移到 struts 2。所以对于下面的代码,我应该使用什么标签。

【问题讨论】:

    标签: struts2 tags migration javabeans struts1


    【解决方案1】:

    在 OGNL 中,您只需通过普通的方法调用(如果有 JavaBean 标准的 getter,则使用 getter)进行访问,例如,

    <s:property value="%{someList.size()}" />
    

    或者使用 OGNL 的列表增强功能:

    <s:property value="%{someList.size}" />
    

    您也可以通过普通的 JSP EL 来做到这一点(最近没有尝试过):

    ${someList.size}
    

    您可能想了解 OGNL 提供的内容;它有点慢,但非常强大。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多