<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Sealyu

    --- 博客已遷移至: http://www.sealyu.com/blog

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks
    here are 3 possible examples how to initialize component:

    1. Using @Unwrap with method returning object - method doesn't have to be getter:

    @Name("search")
    public class SearchAction {
    // can't be used with @Out
    @Unwrap
    public Map<String,Integer> initList() {
    System.out.println("In-method initList");
    Map<String,Integer> list = new TreeMap<String,Integer>();
    list.put("one", 1);
    list.put("two", 2);
    list.put("three", 3);
    return list;
    }
    }

    to use this component on the page you need to call it search:

    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">
    <ui:define name="body">
    <h:form id="search" styleClass="edit">
    <h:selectOneMenu>
    <s:selectItems
    value="#{search}"/>
    </h:selectOneMenu>
    </h:form>
    </ui:define>
    </ui:composition>

    2. Using @Factory with method returning void - method doesn't have to be getter and @Out must be used to outject object to page:

    @Name("search")
    public class SearchAction {
    // use with @Out because creation method is returning void
    @Out
    private Map<String,Integer> list;
    @Factory("list")
    public void initList() {
    System.out.println("In-method initList");
    list = new TreeMap<String,Integer>();
    list.put("one", 1);
    list.put("two", 2);
    list.put("three", 3);
    list.put("six", 6);
    }
    }

    to use this component on the page you need to call it list:

    <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">
    <ui:define name="body">
    <h:form id="search" styleClass="edit">
    <h:selectOneMenu>
    <s:selectItems
    value="#{list}"/>
    </h:selectOneMenu>
    </h:form>
    </ui:define>
    </ui:composition>

    3. Using @Factory with method returning object - method mut be getter, @Out is not needed

    @Name("search")
    public class SearchAction {
    // without @Out annotation
    @Factory("list")
    public Map<String,Integer> getList() {
    System.out.println("In-method initList");
    Map<String,Integer> list = new TreeMap<String,Integer>();
    list.put("one", 1);
    list.put("two", 2);
    list.put("three", 3);
    return list;
    }
    }

    component usage is like in example (2.)

    Additionally class used in all these examples doesn't have to be EJB bean - they only have to be Seam component (marked by @Name annotation).

    Each of these method is different - details can be found in http://chiralsoftware.com/jboss-seam-book/unwrap.seam as previously mentioned Thiago Rocha (thanks).

    posted on 2009-03-10 19:57 seal 閱讀(511) 評論(0)  編輯  收藏 所屬分類: Seam
    主站蜘蛛池模板: 免费看黄网站在线看| 亚洲日韩中文字幕| 337P日本欧洲亚洲大胆艺术图| 无码乱肉视频免费大全合集| 亚洲AV无码成人精品区天堂| 免费在线中文日本| 亚洲中文字幕在线乱码| 成在线人免费无码高潮喷水| 亚洲小说区图片区另类春色| 精品多毛少妇人妻AV免费久久 | 无码AV动漫精品一区二区免费| 永久免费毛片手机版在线看| 久久久久久亚洲精品无码| 在线免费一区二区| 激情婷婷成人亚洲综合| 亚洲成a人片在线观看久| 一区二区三区在线观看免费 | 亚洲熟妇少妇任你躁在线观看无码| 免费播放美女一级毛片| 亚洲免费日韩无码系列| 中文字幕在线免费看| 久久久亚洲欧洲日产国码二区| 亚洲香蕉免费有线视频| 亚洲日韩AV一区二区三区四区 | 国产中文在线亚洲精品官网| 久久久久女教师免费一区| 久久精品国产96精品亚洲| 四虎国产精品免费久久| 日本亚洲高清乱码中文在线观看| 亚洲国产精品尤物YW在线观看| 久青草视频在线观看免费| 亚洲综合在线观看视频| 日韩精品无码人妻免费视频| 精品一区二区三区高清免费观看| 久久亚洲sm情趣捆绑调教| 免费看大黄高清网站视频在线| 国产高潮久久免费观看| 亚洲日本在线免费观看| 免费看一级做a爰片久久| 久操免费在线观看| 亚洲精品成a人在线观看☆|