JBoss Seam从头学到脚之16---eclipse中,dvdstore例子的理解点

  1. org.jboss.seam.international.StatusMessages的源程序中的
    public void add(String messageTemplate, Object... params)方法中的
    "object..."参数的“...”是什么意思?
    解释:
    不定参数列表,可以是0到n个参数(逗号分隔)
    add("Hello {0} {1} {0} {2}", arg0, arg1, arg2)
    参见
    URL:http://seam.group.iteye.com/group/topic/10098   的后部。

  2. 例子中EditCustomerAction.java文件中的,
    facesMessages.add("userName" , "This name is already in use");中的
    "This name is already in use"如何显示在页面中?
    解决办法:可以改成,人性化一点
    facesMessages.add("userName: {0}  is already in use", customer.getUserName());
    参见
    URL:http://seam.group.iteye.com/group/topic/10098
  3. 注册一个新的用户,使用了page flow的知识,用到的flow文件是newuser.jpdl.xml
    EditCustomerAction.java是action的处理。
  4. 把销量最好的8件产品选出来的方法是在components.xml中定义的,写法如下
        <factory name="topProducts"
                 value="#{topQuery.resultList}" />
        <framework:entity-query name="topQuery"
                                ejbql="select p from Product p"
                                order="p.inventory.sales desc"
                                max-results="8" />
    显示的页面是/browse.xhtml

    引申:上面topProducts的factory对应的db中的数据修改后能够立刻体现到页面中,其中的原理?
    //todo
  5. WEB-INF/incl/cart.xhtml文件中,
    <h:commandButton id="Checkout" action="checkout" value="#{messages.checkoutButton}"
                                             styleClass="formButton" style="width: 166px;" />
    而WEB-INF/incl/login.xhtml文件中,
    <h:commandLink id="CreateAccount" action="#{editCustomer.startEdit}">Create Account</h:commandLink>

    上面两个action的写法为什么不同?
    尝试过,把action="#{editCustomer.startEdit}"改成"editCustormer",
    但是报错了。
    不明白
    action="checkout"
    真正含义?
    //解释
    cart.xhtml中的action="checkout"是对应到pages.xml中的
    <rule if-outcome="checkout">
          <redirect view-id="/checkout.xhtml"/>
    </rule>
    和login.xhtml中的action="#{editCustomer.startEdit}">意义不同。

  6. 另一个page flow是checkout.jpdl.xml,
    触发的地方是checkout.xhtml的PurchaseButton按钮,
    对应的action文件是CheckoutAction.java。
    可以学习下,confirm.xhtml文件中
    <h:commandButton id="Confirm" action="purchase" value="Confirm" />
    的写法,这里的action="purchase"的指的是checkout.jpdl.xml中的
    <transition name="purchase" to="complete">中的purchase,
    所以对于action后面的名字所指比较灵活,可以根据具体设计的便利性来设置。
    可以对应pages.xml,也可以对应action,也可以对应pageflow中的一个transition。

 

 END

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值