0

tr:commandNavigationItemを押すとポップアップするモーダル ダイアログを作成しようとしています。ポップアップを表示できます。作成した「キャンセル」ボタンをクリックすると、returnListener が呼び出されますが、ポップアップ自体は消えません。「送信」ボタンを呼び出すと、例外が発生します。

ウェブサイトはフェイスレットを使用しているため、呼び出しページには使用するテンプレートがあります。

ログに次の警告が表示されます。

W org.apache.myfaces.trinidad.component.UIXComponentBase getClientId getClientId should not be called while the view is being constructed. Component ID: holdOrder_hold

W com.ibm.ws.webcontainer.srt.SRTServletResponse setIntHeader SRVE8094W: WARNING: Cannot set header. Response already committed.

呼び出しページ (.xhtml) は次のとおりです。

<tr:navigationPane hint="bar" inlineStyle="width:100%;" id="completeNavBar">
  ...
  <tr:commandNavigationItem id="holdButton" text="#{odMessages['BUTTON_HOLD_ORDER']}" partialSubmit="true" useWindow="true" rendered="#{taskHandler.holdAndReleaseEnabled}" action="dialog:holdOrder" immidiate="true" returnListener="#{taskHandler.handleReturnHoldDialog}" windowHeight="350" windowWidth="800"/>
  ...
</tr:navigationPane>

完全なダイアログ ページ (.xhtml) は次のとおりです。

<ui:composition
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:tr="http://myfaces.apache.org/trinidad"
  xmlns:trd="http://myfaces.apache.org/trinidad/demo"
  xmlns:trh="http://myfaces.apache.org/trinidad/html"> 
  <jsp:directive.page contentType="text/html;charset=utf-8"/>
  <f:view>
    <tr:document title="Put Order On Hold">
            <tr:form>
                <tr:messages globalOnly="true"/>
                <tr:panelFormLayout>

                    <tr:inputText id="holdOrder_comment" rows="5" label="Comment:" value="#{taskHandler.task.holdObj.holdComment}" />

                    <f:facet name="footer">
                        <tr:commandButton id="holdOrder_hold" actionListener="#{taskHandler.holdToDo}" text="Submit" partialSubmit="true"/>
                        <tr:commandButton id="holdOrder_cancel" actionListener="#{taskHandler.cancelDialog}" text="cancel" partialSubmit="true"/>
                    </f:facet>
                </tr:panelFormLayout>
            </tr:form>
    </tr:document>
  </f:view>
</ui:composition>

使用される単一のバッキング Bean は次のとおりです。

@ManagedBean
@ViewScoped
public class TaskHandler implements Serializable {

...

    public void holdToDo(ActionEvent event) {
        System.out.println("putting on hold");
        HashMap<Object, Object> returnMap = new HashMap<Object, Object>();
        try {
            boolean response = ToDoHold.execute(task);

            if(!response) {

                returnMap.put("returnValue", "no validation errors");
            }
        } catch (Exception e) {
            System.out.println("exception in holdToDo");
            e.printStackTrace();
        }

        RequestContext.getCurrentInstance().returnFromDialog(Boolean.TRUE, returnMap);
    }

    public void handleReturnHoldDialog(ReturnEvent event) {
        System.out.println("returning hold Dialog");
    }

    public void cancelDialog(ActionEvent event) {
        System.out.println("cancelling dialog");
        try {
            HashMap<Object, Object> returnMap = new HashMap<Object, Object>();
            returnMap.put("returnValue", "cancel");
            RequestContext.getCurrentInstance().returnFromDialog(Boolean.FALSE, returnMap);
        } catch(Exception e) {
            System.out.println("cancelling dialog: exception");
            e.printStackTrace();
        }
    }
...

}

使用したバージョン: Trinidad 2.0.1 JSF 2.0 Servlet 3

4

1 に答える 1

0

したがって、これを完全に解決することはできませんでしたが<f:facet name="footer">、ダイアログで使用していた問題 (XHTML は上記で利用可能) が問題の原因であり、ファセットを削除すると両方のボタンが正しく機能し始めたことが判明しました。これはバグかもしれませんが、企業のガイドラインにより、トリニダード (1.26) の最新でないバージョンを使用しています。

于 2014-01-13T15:10:44.083 に答える