You have to set up the dialog data yourself. One way to do that is with an
action state as the starting state for a dialog; for example:

 <dialog name="Payment" start="Setup">
   <action name="Setup"
         method="#{dialogLauncher.setupPaymentDialog}">
      <transition outcome="success"
                   target="Payee Information"/>
   </action>

   <!-- Payee Information -->
   <view name="Payee Information"
       viewId="/billpay/payment/wizard.jsp">
     <transition outcome="next"
                    target="Payment Method"/>
   </view>
...
  </dialog>
</dialog>

The Setup state is an action state, so it invokes
dialogLauncher.setupPaymentDialog(), which returns a string that Shale
immediately uses as an outcome.

Here's the method:

public class DialogLauncher extends AbstractFacesBean {
   public String setupPaymentDialog() {
      // Create billpay data
      billpayData = new BillpayData();

      // Set dialog data with the handy setValue method
      // from org.apache.shale.view.AbstractFacesBean
      setValue("#{dialog.data}", billpayData);

      // This outcome takes us to the payment dialog's
      // first view state
      return "success";
   }
}

In my views, I have fields wired to my dialog.data:

<h:inputText id="paymentAmount"
            value="#{dialog.data.paymentAmount}"/>


david

2006/7/27, Sean Comerford <[EMAIL PROTECTED]>:

I've had no problem setting up a dialog but I can't figure out how to use
the dialog scoped data. I need a simple example I guess...

So assuming the following dialog:

<dialog name="testDialog" start="step1">
  <view name="step1" viewId="/step1.jsp">
    <transition outcome="next" target="step2" />
  </view>
  <view name="step2" viewId="/step2.jsp">
    <transition outcome="prev" target="step1" />
    <transition outcome="exit" target="exit" />
  </view>
  <end name="exit" viewId="/done.jsp" />
</dialog>

I want to have a text input with a value bound to #{dialog.data.name} in
step1.jsp so I can refer to it in step2.jsp

But if, in step1.jsp, I just try:

<af:inputText value="#{dialog.data.name} />

The input doesn't show up because the binding doesn't exist and clearly I
can't access it again later :)

So it seems I need a backing bean to hold name but I'm not sure what to
call
it / how to point to it.

Can someone dumb this down for me?

--
Sean Comerford, Software Engineer
Major League Baseball Advanced Media
[EMAIL PROTECTED] ~ 212.485.4508




************************
MLB.com: Where Baseball is Always On



Reply via email to