<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
    主站蜘蛛池模板: 亚洲成a人无码亚洲成www牛牛 | 亚洲91精品麻豆国产系列在线 | 免费激情网站国产高清第一页| 97视频免费在线| 久久亚洲欧美国产精品| 亚洲精品成人无限看| 国产免费久久精品99久久| 亚洲精品国产精品国自产观看 | 51午夜精品免费视频| 亚洲精品国产精品乱码不卞| 免费av片在线观看网站| 亚洲AV无码一区东京热| 成人片黄网站色大片免费观看APP| 亚洲线精品一区二区三区影音先锋| 99re免费在线视频| 羞羞视频在线观看免费| 亚洲卡一卡2卡三卡4麻豆| 色妞WWW精品免费视频| 拍拍拍无挡视频免费观看1000 | 久久久精品国产亚洲成人满18免费网站 | 亚洲人精品亚洲人成在线| 亚洲人成人无码网www电影首页| 24小时日本在线www免费的| 国产情侣久久久久aⅴ免费| 美女露隐私全部免费直播| 亚洲无码日韩精品第一页| 在线视频观看免费视频18| 亚洲AV无码精品国产成人| 亚洲视频在线一区二区三区| 久久亚洲AV永久无码精品| 国产精品99精品久久免费| 亚洲国产美女在线观看| 午夜神器成在线人成在线人免费 | 中文字幕无码精品亚洲资源网久久| 一本色道久久综合亚洲精品| 日本免费v片一二三区| 91免费精品国自产拍在线不卡| 日本免费人成网ww555在线| 产传媒61国产免费| 国产午夜亚洲精品不卡免下载 | 搡女人免费免费视频观看|