日期:2014-05-16  浏览次数:20399 次

JSF多对多增加
多对多关系时 person (n-n) work (person 增加work)
一般的都是多对一关系,一 弹出框增加 多,多对多时,增加一个中间变量,
这里是personHome.work,这个很关键immediate="true"actionListener="#{personHome.setWork(personHome.work)}"
<s:decorate id="workField" template="/layout/edit.xhtml" rendered="#{!workHome.managed}">
<ui:define name="label">请选择</ui:define>
    <h:selectOneMenu id="work" immediate="true"
                        layout="lineDirection" required="true"
                            value="#{personHome.work}"
>
                     <s:selectItems  value="#{personHome.works}" var="work"
     label="#{work.name}" required="true"
     noSelectionLabel="请选择" />
<s:convertEntity />
<a:support event="onchange" actionListener="#{personHome.setWorkstage(personHome.workstage)}"
bypassUpdates="false" ajaxSingle="true" reRender="worksInfoDiv"
ignoreDupResponses="true" eventsQueue="default"
/>
                </h:selectOneMenu>
    </s:decorate>