1

SEAM 2アプリケーションがあり、奇妙な状況があります。私はEclipseIndigoで開発していますが、グリッド付きのページを作成する必要があります。各行には、リスト付きのポップアップウィンドウを表示するボタンがあり、リンク付きのリストの1つの項目を選択すると、選択した値が表示されます。行で。

だから私はこのコンポーネントを持っています:

@Name("paramContHome")
@Scope(ScopeType.CONVERSATION)
public class ParamContHome extends KubeDAO<ParametroSistema>{

    private static final long serialVersionUID = 1L;

    @In
    private LoginUser loginUser;

    @In(required=false,create=true)
    private CuentaContHome cuentaContHome;

    public void load(){
        try{
            setInstance(getEntityManager().find(ParametroSistema.class, prctId));
        }catch (Exception e) {
            clearInstance();
            setInstance(new ParametroSistema());
        }
    }

    public void selCuentaParam(ParametroSistema par) {
        setSelParam(par);
        cuentaContHome.getCuentasList();
    }

    public void setCuentaParam(CuentaContable cta) {
        selParam.setValorNum(cta.getId().floatValue());
        selParam.setSelObj(cta);
    }

    ...

    }

これには、xhtmlページから呼び出そうとしているメソッドが含まれています。これはxhtmlページです:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!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:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:p="http://primefaces.prime.com.tr/ui"
    template="/layout/templateKu.xhtml">
    <ui:define name="body">
        <rich:panel>
            <f:facet name="header">#{app.paramact_head}</f:facet>
            <rich:spacer height="20" />
            <h:form id="formA">
                <p:growl globalOnly="true" sticky="false" life="3000" />
                <p:focus />
                <a:queue name="q1" />

                <rich:dataTable var="res" value="#{paramContHome.resultList}"
                    rendered="#{not empty paramContHome.resultList}" rows="10"
                    align="center" rowClasses="tableInfo1 tableInfo2"
                    headerClass="tablaHeader" footerClass="tableScroll">
                    <f:facet name="header">#{app.paramact_list}</f:facet>

                    <rich:column filterBy="#{res.nombre}" filterEvent="onkeyup">
                        <f:facet name="header">#{app.paramact_nombre}</f:facet>
                        <h:outputText value="#{res.nombre}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">#{app.transferencia_valornum}</f:facet>
                        <h:inputText value="#{res.selObj.nombre}" size="20" >
                            <a:support event="onblur" ajaxSingle="true" eventsQueue="q1" reRender="_table"/>
                        </h:inputText>
                        <a:commandButton ajaxSingle="true"   
                            action="#{paramContHome.selCuentaParam(res)}" reRender="sCta" 
                            onclick="#{rich:component('selCta')}.show();"
                            styleClass="modifyBtn" value=" " style="width:30px;">
                        </a:commandButton>
                    </rich:column>
                    <f:facet name="footer">
                        <rich:datascroller id="ds1" renderIfSinglePage="true" />
                    </f:facet>
                </rich:dataTable>
            </h:form>
        </rich:panel>
        <rich:modalPanel id="selCta" width="400" moveable="false" autosized="true" top="50px" 
            onbeforeshow="activeModal.setActiveModalPanel('selCta');">
            <f:facet name="header">#{app.general_lov}</f:facet>
            <f:facet name="controls">
                <h:panelGroup>
                    <h:graphicImage value="/kubeImg/close.png" styleClass="closeBtn" 
                        onclick="#{rich:component('selCta')}.hide();" />
                </h:panelGroup>
            </f:facet>
            <s:div id="sCta"><ui:include  src="selCta.xhtml" /></s:div>
        </rich:modalPanel>
    </ui:define>
</ui:composition>

これは、コンポーネントparamContHomeのメソッドselCuentaParamを呼び出したいボタンです。

<rich:column>
    <f:facet name="header">#{app.transferencia_valornum}</f:facet>
    <h:inputText value="#{res.selObj.nombre}" size="20" >
        <a:support event="onblur" ajaxSingle="true" eventsQueue="q1" reRender="_table"/>
    </h:inputText>
    <a:commandButton ajaxSingle="true"   
        action="#{paramContHome.selCuentaParam(res)}" reRender="sCta" 
        onclick="#{rich:component('selCta')}.show();"
        styleClass="modifyBtn" value=" " style="width:30px;">
    </a:commandButton>
</rich:column>

このメソッド内で、別のコンポーネントcuentaContHomeからメソッドを呼び出します。

@In(required=false,create=true)
private CuentaContHome cuentaContHome;
...
public void selCuentaParam(ParametroSistema par) {
setSelParam(par);
cuentaContHome.getCuentasList();
}

しかし、アプリケーションを実行してページにアクセスし、ボタンを押すと、メソッドselCuentaParamが呼び出されません。ブレークポイントをその中に置き、System.out.printlnを置き、それを呼び出さないので、これをチェックしました。これが発生する理由を知っていますか、コンポーネントの初期化に関連するものですか?

よろしく。

4

1 に答える 1

1

さて、私は問題を見つけたと思います。私の画面では、特定のパターンに従います。最初に、新しいレコードを作成するためのフォームを持つ 2 番目の xhtml に移動するためのボタンを使用して、データベース レコードのグリッドを表示する xhtml があります。このボタンは会話を開始するため、フォーム (detail.xhtml と呼びます) を持つ xhtml では、会話を開始するか、既存の会話に参加します。そこで、最初の xhtml (私は list.xhtml と呼びます) の pages.xml を次のように変更しました。

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.com/products/seam/pages"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.2.xsd">
 <action execute="#{paramContHome.getParametrosContables()}" on-postback="false"/>

       <begin-conversation propagation="begin" join="true" />

</page>

最初にちょうど使用<begin-conversation />しましたが、この例外が発生begin() called from long-running conversation, try join=trueするため、これを開始会話に追加すると機能します!!

于 2011-12-19T12:18:48.790 に答える