<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 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      618 隨筆 :: 87 文章 :: 225 評(píng)論 :: 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 閱讀(512) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Seam
    主站蜘蛛池模板: 亚洲AV色无码乱码在线观看 | 亚洲精品视频观看| 国产精品怡红院永久免费| 在线精品亚洲一区二区 | 最新亚洲卡一卡二卡三新区| 国产免费牲交视频| 亚洲免费人成在线视频观看| 亚洲国产成人手机在线电影bd | 最新欧洲大片免费在线 | 91精品国产免费入口| 亚洲youwu永久无码精品| 亚洲香蕉成人AV网站在线观看| 免费视频爱爱太爽了| 免费人成大片在线观看播放| 亚洲黄色网址大全| 波多野结衣免费视频观看| 免费精品无码AV片在线观看| 久久亚洲中文字幕无码| 亚洲国产精品SSS在线观看AV| 精品久久久久久久免费人妻| 未满十八18禁止免费无码网站| 亚洲成av人在线观看网站| 亚洲av色福利天堂| av在线亚洲欧洲日产一区二区| 国产人在线成免费视频| a视频在线观看免费| 理论亚洲区美一区二区三区| 亚洲美女视频一区| 国产亚洲AV无码AV男人的天堂| 日本不卡免费新一二三区| 亚欧在线精品免费观看一区| a在线视频免费观看| 色妞www精品视频免费看| 亚洲成人网在线播放| 亚洲精品成人片在线播放| 国产一区二区三区免费在线观看| 免费观看黄色的网站| 久久免费高清视频| igao激情在线视频免费| 羞羞漫画在线成人漫画阅读免费 | 国产午夜免费高清久久影院|