f:attribute 与 af:clientAttribute 用法

f:attribute 与 af:clientAttribute 用法

  (2013-09-26 10:44:34)
标签: 

it

类:
f:attribute,af:clientAttribute可以在监听时取到相对应binding的值。

如用for Each 循环 或表时,取当前行的字段的值
在bean取用 f:attribute

在用会用actionlistener的组件下加  f:attribute
                             <af:commandLink partialSubmit="true"
                                                                                    clientComponent="true"
                                                                                    id="cl2"
                                                                                    text="·#{bindings.EcpExInfoAnnounceVO1.children[stat.index].InfoAnnounceTitle}"
                                                                                    inlineStyle="color:rgb(99,99,99); font-size:12.0px;"
                                                                                    actionListener="#{HomePageBean.gotoinfo}">
                                                               <f:attribute name="InfoAnnounceId"
                                                                                   value="#{bindings.EcpExInfoAnnounceVO1.children[stat.index].InfoAnnounceId}"/>
                                                            </af:commandLink>
                                                          
bean代码 
  public void gotoinfo(ActionEvent actionEvent) {
            Map attr = actionEvent.getComponent().getAttributes();
            String InfoAnnounceId = attr.get("InfoAnnounceId").toString();
            System.out.println(InfoAnnounceId);
}

在js取用 af:clientAttribute
                                             <af:commandLink id="cl4" partialSubmit="true">
                                                <af:image clientComponent="true" id="image5"
                                                               source="#{bindings.ProfileValue.inputValue}#{bindings.result.children[stat.index].ShortPicUrl}"
                                                               inlineStyle="width:150px;height:135px;"
                                                               imageMapType="server">
                                                   <af:clientAttribute value="#{bindings.ProfileValue.inputValue}#{bindings.result.children[stat.index].DetailPicUrl}"
                                                                                 name="url"/>
                                                   <af:clientAttribute name="ProductName"
                                                                                 value="产品名称:#{bindings.result.children[stat.index].ProductName}"/>
                                                   <af:clientAttribute value="产品详情:#{bindings.result.children[stat.index].Description}"
                                                                                 name="Description"/>
                                                   <af:clientListener method="showDetail"
                                                                                type="click"/>
                                                   <af:showPopupBehavior triggerType="click"
                                                                                    align="endAfter"
                                                                                    popupId="::ProductDeatilPopup"/>
                                                </af:image>
                                             </af:commandLink>

js代码
       
            function showDetail(e) {
                  var im = e.getSource();
                  var name = im.getProperty("ProductName");
                  var popup = AdfPage.PAGE.findComponent("ProductDeatilPopup");
                  var productname = popup.findComponent("ProductDeatilNameOt");
                  var image = popup.findComponent("ProductDeatilImage");
                  if (image) {
                        image.setSource(im.getProperty("url"));
                  }
                  if (productname) {
                        productname.setValue(im.getProperty("ProductName"));
                  }
                  var desc = popup.findComponent("ProductDeatilOt");
                  if (desc) {
                        desc.setValue(im.getProperty("Description"));
                  }
            }
       
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值